I am trying to build a plugin and at the moment my plugin contains only plugin.php file.

There is not a real code in it yet:

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

And I am getting these errors as long as the plugin is activated:

Warning: session_start(): Cannot send session cache limiter - headers already sent - (output started at /home1/website/public_html/wp-content/plugins/plugin-name/plugin-name.php:1) in /home1/website/public_html/wp-content/plugins/flexible-shipping/classes/flexible-shipping-plugin.php on line 169

Warning: Cannot modify header information - headers already sent by (output started at /home1/website/public_html/wp-content/plugins/plugin-name/plugin-name.php:1) in /home1/website/public_html/wp-admin/includes/misc.php on line 1124

I already faced an issue like this and it was due to whitespaces, but I don't have any whitespaces this time... I barely have a plugin...



You start the PHP code with short tags <?.
If it is on a server with short tags disabled, the PHP code is not rendered and is outputted.

Then it's better to use complete tags <?php.

  • It happens either way. I tried copying plugin info from another plugin and paste it in mine and I am getting these errors too – Omer Aug 3 '18 at 7:36

Follow these approaches to build wordpress plugin

  • Always create a separate directory for holding plugin files
  • always include index.php file ( it contains nothing ) in folders that hold important assets ( classes, and admin files )
  • restrict direct access to files using
  • `if(!defined('ABSPATH'){ exit; }
  • always include files conditionally e.g. if ( is_admin() ){ require_once '...'; }

Above points are just few points that you can follow in order to develop wordpress plugins.

Regarding your question, I think that should have worked

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
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}.

`You can restart web server, go to settings>permalinks then save settings. Lets see if that helps


As there is no usable code at this time, it can not generate errors and warnings you have reported.

It is also reporting errors from two .php files.

Had you plugin file with same name before ? One time I kept changing code but it made no difference to output. I even tried <? die(); as first command but no effect. Page refreshing was also not helping. I changed name of that file and it worked. Server insisted on serving output it had saved somewhere.

I would suggest you to change name of the plugin file to be sure.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.