我正在尝试构建一个插件,目前我的插件只包含plugin.php
文件
其中还没有真正的代码:
<?
/*
Plugin Name: Plugin Name
Plugin URI: https://www.example.info
description: A description about the plugin
Version: 1.0.0
Author: Author Name
Author URI: https://www.example.info
License: GPL2
*/
只要插件被激活,我就会收到这些错误:
警告:session\\u start():无法发送会话缓存限制器-标头已发送-(输出开始于/home1/website/public\\u html/wp content/plugins/plugins name/plugin name.php:1)in/home1/website/public\\u html/wp content/plugins/flexible shipping/classes/flexible shipping plugin。php第169行
警告:无法修改标题信息-标题已由/home1/website/public\\u html/wp-content/plugins/plugin-name/plugin-name.php:1)in/home1/website/public\\u html/wp-admin/includes/misc发送。php在线1124
我已经遇到了这样的问题,这是由于空白,但我这次没有任何空白。。。我几乎没有插件。。。
谢谢
SO网友:maverick
遵循以下方法构建wordpress插件
始终为保存插件文件创建单独的目录始终包含索引。php文件(不包含任何内容)位于包含重要资产(类和管理文件)的文件夹中,使用if(!defined(\'ABSPATH\'){exit;}限制对文件的直接访问总是有条件地包括文件,例如if(is\\u admin()){require\\u once\'…\';}以上几点只是开发wordpress插件可以遵循的几点。
关于你的问题,我认为这应该奏效
<?php
/*
Plugin Name: WordPress.org Plugin
Plugin URI: https://developer.wordpress.org/plugins/the-basics/
Description: Basic WordPress Plugin Header Comment
Version: 20160911
Author: WordPress.org
Author URI: https://developer.wordpress.org/
Text Domain: wporg
Domain Path: /languages
License: GPL2
{Plugin Name} is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
any later version.
{Plugin Name} is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with {Plugin Name}. If not, see {License URI}.
*/
`您可以重新启动web服务器,进入“设置”>“永久链接”,然后保存设置。让我们看看这是否有帮助