Plugin Headers

Plugin headers are an important component that informs WordPress that the PHP file inside the plugins directory is a WordPress plugin. Such headers look like a PHP comment at the beginning of the main file. Headers have their own standard, described below.

Possible Plugin Headers

The plugin header must be located in the main plugin file and only there.

At a minimum, the header must contain the name of the plugin:

<?php
/**
 * Plugin Name: My First Plugin
 */

// plugin code

Other data can also be specified in the header:

<?php

/**
 * Plugin Name: Plugin Name
 * Description: Plugin description (140 characters)
 *
 * Plugin URI:  Link to the plugin page
 * Author URI:  Link to the author
 * Author:      Author name
 *
 * Text Domain: Translation ID, specified in load_plugin_textdomain()
 * Domain Path: Path to the translation file.
 *
 * Requires at least: 5.7
 * Requires PHP: 7.0
 *
 * License:     GPL2
 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
 *
 * Network:     true - activates the plugin for the entire network
 * Update URI:  https://example.com/link_to_update
 *
 * Requires Plugins: some-plugin, some-plugin-2
 *
 * Version:     1.0
 */

// plugin code
Plugin Name:(required)
The name of the plugin, which is displayed in the plugin list in the admin area.
Description:
A brief description of the plugin, which is displayed in the Plugins section in the admin area. It is recommended not to exceed 140 characters.
Version:
The current version number of the plugin, for example, 1.0 or 1.0.3.

When setting the version, keep in mind that WP uses the version_compare() function for version comparison. Therefore, when changing the version, ensure that the new version is higher. For example, 1.02 is greater than 1.1.

Plugin URI:
The homepage of the plugin, which can be on WordPress.org or on your own site.
Author:
The name of the plugin author. There can be more than one author in the list.
Author URI:
The author's website or profile on another website, such as WordPress.org.
Requires at least:
The minimum required version of WordPress. For example: 5.7.
Requires PHP:
The minimum required version of PHP. For example: 7.4.
License:
The short name of the plugin license, such as GPL2. More detailed information about licensing can be found on WordPress.org.
License URI:
A link to the license, for example, https://www.gnu.org/licenses/gpl-2.0.html.
Text Domain:
The translation identifier (localization domain), used in localization functions and in the name of the .mo translation file. For more details, see quote here.
Domain Path:
Needed if the translation file is not in the same folder as the current file. For example, if the .mo file is in the /myplugin/languages folder and the plugin file is in /myplugin/myplugin.php, then specify /languages here.
Network:
Specify "true" for the plugin to be activated across the entire network of sites in the MU WordPress build. This will make it impossible to activate the plugin for a single site if the multisite is activated.
Update URI:
The URL for updating the site. Used in the wp_update_plugins() function. A hook update_plugins_(hostname) will be created from the domain.
Requires Plugins:(WP 6.5)
A list of plugins that the current plugin depends on. You need to specify the plugin slugs (comma-separated). For example, my-plugin (usually this is the name of the plugin folder).

The format my-plugin/my-plugin.php is not supported.

Read more about plugin dependencies here.

Header Size

The plugin header is parsed by the get_plugin_data() function, which only processes the first 8KiB (6000-8000 characters) of information, and if the plugin data exceeds this, the author will have to reduce it or move the plugin data to the top. This can happen, for example, if license data is added before the plugin data.

Specifying the Plugin License

Most WordPress plugins are published under the GPL license, which corresponds to the same license used by WordPress itself. However, there are other options. It is better to always clearly specify which license your plugin uses.

It was shown above that the license can be specified in the header parameter License:. But there is another common practice - to place the license block under the plugin headers in the main plugin file.

The license block looks something like this:

{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 {URI to Plugin License}.

Combined with the plugin headers, we get:

/**
 * Plugin Name:  Plugin Name
 * Plugin URI:   http://URI_Of_Page_Describing_Plugin_and_Updates
 * Description:  This describes my plugin in a short sentence
 * Version:      1.5
 * Author:       John Smith
 * Author URI:   http://URI_Of_The_Plugin_Author
 * 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}.
*/

PHPDoc DocBlock

You can also mix anything into the headers, for example, you can add a PHPDoc documentation block for various IDEs:

/**
 * Plugin Name
 *
 * @package           PluginPackage
 * @author            Your Name
 * @copyright         2019 Your Name or Company Name
 * @license           GPL-2.0-or-later
 *
 * @wordpress-plugin
 * Plugin Name:       Plugin Name
 * Plugin URI:        https://example.com/plugin-name
 * Description:       Description of the plugin.
 * Version:           1.0.0
 * Requires at least: 5.2
 * Requires PHP:      7.2
 * Author:            Your Name
 * Author URI:        https://example.com
 * Text Domain:       plugin-slug
 * License:           GPL v2 or later
 * License URI:       http://www.gnu.org/licenses/gpl-2.0.txt
 */

--

Read also: https://developer.wordpress.org/plugins/plugin-basics/header-requirements/