WP Ref

Plugin Headers

Every WordPress plugin contains a plugin header. The plugin header is a multi-line PHP comment containing various details about the plugin. WordPress detects if a file represents a plugin if it contains a plugin header.

The details in the header are used on the Plugins dashboard page.

Here is the simplest example of a plugin header:

<?php /** * Name: My Plugin */
Code language: PHP (php)

The following fields are available for use in a plugin header:

  • Plugin Name: The name of the plugin.
  • Plugin URI: The main web page for your plugin, outside of WordPress.org. A WordPress.org URL cannot be used here.
  • Description: A sentence or two about the plugin. What does it do in a nutshell?
  • Version: The current plugin version.
  • Requires at least: The minimum WordPress version that the plugin is compatible with.
  • Requires PHP: The minimum PHP version that the plugin is compatible with.
  • Author: The plugin author, whether an individual or organization. Multiple authors can be listed comma-separated.
  • Author URI: The author’s website or a web page relating to the author.
  • License: The short name of the license this plugin is to use.
  • License URI: A URL pointing the the full text for this plugin’s license.
  • Text Domain: The gettext text domain this plugin uses.
  • Domain Path: WordPress uses the domain path to find where this plugin’s translations are stored.
  • Network: Determines whether the plugin is only allowed to be activated network-wide. Only add this field and set it to true if needed.
  • Update URI: Helps prevent another plugin in the WordPress plugin directory from overriding this plugin when it’s updated.

In Conclusion

The plugin header is required for WordPress to recognize your plugin. While it may feel mundane to fill out, it’s arguable most important when it comes to distributing a plugin and/or the plugin is being developed for a client.


Posted

in

by

Tags:

Need WordPress development services?

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *