Plugin Header Requirements

Plugin Header Requirements

The main PHP file of a plugin is the one that contains certain header information which tells ClassicPress that it is a plugin, and provides information about the plugin. ClassicPress only supports plugin files in the base plugins directory (wp-content/plugins) and in one directory above the plugins directory (wp-content/plugins/my-plugin). The file it looks for has the plugin data and must be found in one of those two locations.

There are several fields which are required to be included in the plugin header (there is an overlap with the content of the readme.txt). All plugin data must be on its own line. For plugin description, it must not have any newlines.

There are several fields which are required to be included in the plugin header (there is an overlap with the content of the readme.txt):

  • Plugin Name – Name of the plugin; should be unique.
  • Plugin URI – The plugins home page, which should be a unique page, ideally on your own site or in the GitHub repository.
  • Description – A short description, no more than 140 characters, of the plugin which will be displayed in the ClassicPress Admin.
  • Version – The current version of the plugin (e.g. 1.0.3 or 2.1.1); for ClassicPress plugins the version should follow semantic versioning.
  • Author – Name of the plugin author; multiple authors may be listed, separated with commas.
  • Author URI – The author’s website or ClassicPress Forum profile.

There are additional fields which can optionally be included:

  • Text Domain – The gettext text domain of the plugin. This should be unique per plugin and should be same as the one used in load_plugin_textdomain().
  • Domain Path – The folder location of the translations; this is only useful if the translations are in a folder above the plugin’s base path. For example, if .mo files are located in the languages folder then Domain Path will be “/languages/” and must have the first slash.
  • Network -Specify “true” if the plugin is activated across all sites in an installation. This prevents the plugin being activated on a single site when Multisite is enabled. If this will not be “true” then the line should be omitted.
  • License – The short name of the applied license, such as “GPLv2 or later”. All plugins submitted to the ClassicPress Plugin Directory must be licensed under a GPL license or have a GPL compatible license.
  • License URI – A link to the full text of the license, such as http://www.gnu.org/licenses/gpl-2.0.html.

This is an example of how a plugin header might look:

/*
Plugin Name: My Plugin
Plugin URI: https://www.example.com/plugins/my-plugin/
Description: My plugin has this functionality, and although this is a long description, it contain no newline characters.
Version: 1.0.0
Author: John Smith
Author URI: https://www.example.com/authors/john-smith/
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: john-smith-my-plugin
Domain Path: /languages/
*/