Languages: English • 日本語 Português do Brasil • (Add your language)
In WordPress Themes and Plugins consist of one or more files of which one has (Drop-Ins, Must-Use-Plugins: can have) so called File Headers containing meta-information (Name, Version, Author, ...) regarding the concrete Theme or Plugin.
File Headers are placed inside a block in the beginning of the file (not necessarily starting on the very first line), one header per line. A Header consists of a Name and a Value.
The following file header examples are taken out of example theme and plugin files that do ship with WordPress or are closely related to the WordPress project (Default Theme and Core Plugin):
This is an example for the health-check.php
file, part of the Health Check plugin:
<?php /* Plugin Name: Health Check Plugin URI: https://wordpress.org/plugins/health-check/ Description: Checks the health of your WordPress install Version: 0.1.0 Author: The Health Check Team Author URI: http://health-check-team.example.com Text Domain: health-check Domain Path: /languages */
Here's another example which allows file-level PHPDoc DocBlock as well as WordPress plugin file headers:
<?php /** * 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 * 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 */
These are the very first lines of a the style.css
file part of the Twenty Thirteen theme:
/* Theme Name: Twenty Thirteen Theme URI: http://wordpress.org/themes/twentythirteen Author: the WordPress team Author URI: http://wordpress.org/ Description: The 2013 theme for WordPress takes us back to the blog, featuring a full range of post formats, each displayed beautifully in their own unique way. Design details abound, starting with a vibrant color scheme and matching header images, beautiful typography and icons, and a flexible layout that looks great on any device, big or small. Version: 1.0 License: GNU General Public License v2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html Tags: black, brown, orange, tan, white, yellow, light, one-column, two-columns, right-sidebar, flexible-width, custom-header, custom-menu, editor-style, featured-images, microformats, post-formats, rtl-language-support, sticky-post, translation-ready Text Domain: twentythirteen This theme, like WordPress, is licensed under the GPL. Use it to make something cool, have fun, and share what you've learned with others. */
The following is a list of Header-Names that are currently used by Themes and Plugins in the current concrete File Header default implementation (02 Jun 2010). Headers can be extended, so this is a subset, not the superset:
For a description of some of the Plugin Headers, please see Plugin File Headers, For Theme Headers please see Theme Stylesheet.
If you are unable to find a concrete specification for the one or other header, you need to read the WordPress source-code to find out more specific information about them (please see File Header Related Functions below for a list of related functions and hooks).
Since multiple files in a plugin/theme can contain meta information, the following are the file-names and the order (from top to bottom) of which files are parsed for headers.
style.css
CSS-filePer de-facto implementation, File Headers can be specified as the following:
Note: Because of the nature that there are individual headers, the maximum number of words as well as the minimum and maximum number of characters per word are based on default headers. Because this is a subset and not the superset of all header names, this might vary depending on the implementation and plugins you are using.
The File Header API consists of all functions regarding theme and plugin file headers and related hooks (actions, filters).
extra_*_headers
(e.g.: extra_theme_headers
, extra_plugin_headers
)Some of the API functions provide the possibility to add a context to headers. There are two contexts defined in the wordpress core code: Themes ('theme'
) and Plugins ('plugin'
).
Some plugins contain the readme.txt file which might contain look-a-like headers as well. Those files are not handled by WordPress but by third-party applications. Because those applications can be quite popular, I note down here those tags from an example readme file:
Contributors: markjaquith, mdawaffe (this should be a list of wordpress.org userid's) Donate link: http://example.com/ Tags: comments, spam Requires at least: 2.0.2 Tested up to: 2.1 Stable tag: 4.3
As ticket #12260 suggests, the headers from readme.txt are used through remote WP.org API calls. This is a good example of how third party applications use has direct impact on wordpress core code usage.