Plugin Header Generator

Write the header block and bootstrap for a plugin's main PHP file, without hunting for the field names.

Runs on your deviceWordPressWorkingNo account needed

What this tool does

Plugin Header Generator produces a whole main plugin file, not a snippet to paste somewhere: the opening PHP tag, the docblock WordPress reads when it builds the Plugins screen, and — if you ask for it — the code beneath that prepares the plugin to do work. WordPress only recognises a plugin when that header sits in a PHP file directly inside the plugin's own folder, so the summary line names the exact path to save the output at, in the form slug/slug.php.

The folder name doubles as the text domain, and both are derived from the plugin name by folding accents, dropping punctuation and turning spaces into hyphens (underscores survive), unless you set the folder field yourself. That single slug then drives the Text Domain line, the PHP function prefix, the four uppercase constants and the PascalCase class name, so those never drift apart. Domain Path is always written as /languages. Plugin URI and Author URI are normalised to a full https:// address with any trailing slash removed, so typing example.com/reading-time is enough.

Version is the one field that is checked rather than copied. It has to be one to four dot-separated numbers with an optional pre-release suffix, because that is the shape WordPress can compare when it decides whether an update is newer; something like "one point oh" is refused with an error instead of being written into a header that would quietly break update checks. The Body setting decides how much comes after the docblock: header only, header plus an ABSPATH guard with version, file, path and URL constants and activation and deactivation hooks, or header plus a singleton class with an instance() accessor wired to the init action.

The limits are worth knowing before you start. This writes one file and nothing else — no readme.txt, no /languages directory, no .pot template, no licence file and no zip, so a plugin meant for the wordpress.org directory still needs the readme written by hand. The generated body is scaffolding: the init function only loads the text domain, and the activation and deactivation hooks only flush rewrite rules, which is useful if you go on to register post types or rewrites and pointless if you do not. Requires at least and Requires PHP are passed through exactly as typed with no validation, only Version is checked, and nothing here can tell you whether the slug you picked is already taken on wordpress.org.

How to use it

  1. Name the plugin. This is the name shown on the Plugins screen. Leave the folder field empty and the slug, text domain, constant prefix and class name are all derived from it.
  2. Describe it in the input box. One or two sentences; line breaks and runs of spaces are collapsed into a single line. Leave it empty and the Description field falls back to a plain sentence rather than being written blank.
  3. Fill in the plugin meta you actually have. Author, Author URI, Plugin URI, the minimum WordPress and PHP versions, the licence. Fields left empty are omitted from the header entirely instead of appearing with nothing after the colon.
  4. Choose how much body to generate. Header only for a file you will write yourself, guards and hooks for a small procedural plugin, or the singleton class for anything past a couple of functions.
  5. Set Network-only or Update URI if they apply. Network writes Network: true, which makes the plugin network-activate-only on multisite. Update URI needs a Plugin URI to point at, and the job is refused if you tick it without one.
  6. Save the output at the path in the summary. Create the folder under wp-content/plugins, save the file inside it with the same name, and the plugin appears on the Plugins screen ready to activate.

Processing & privacy

Runs on your device. Your file is processed directly in this browser.

Common use cases

Promoting functions.php snippets into a real plugin

Code in a theme's functions.php dies with the theme. A generated bootstrap gives those snippets a file of their own that survives a redesign.

Getting the text domain right before any translation work

The Text Domain has to match the folder for translations to load. Deriving both from one slug removes the mismatch that leaves strings stubbornly untranslated.

Keeping a private plugin off the update path

A plugin whose slug collides with a public one can be overwritten by an update from wordpress.org. Update URI, written alongside a Plugin URI, tells WordPress to leave it alone.

Checking a header you inherited

Generate a correct block for the same plugin and compare field names and spelling against the file you were handed, rather than guessing which line WordPress is ignoring.

Questions

Is anything uploaded?
No. The whole file is assembled in this browser tab from the settings you type, nothing is transmitted or stored, and the tool keeps working with the network disconnected.
Where exactly does the file go?
In its own folder under wp-content/plugins, with the file name matching the folder — reading-time/reading-time.php, for example. The summary under the output prints the path for the slug you chose.
What does the header-only option leave out?
The ABSPATH guard, the four constants for version, file, path and URL, and either the hook functions or the class. You get the docblock and the PHP tag alone, which suits a file whose body already exists.
Does it write readme.txt or the translation files?
No. It writes the single main PHP file. The readme.txt that carries Tested up to, the stable tag and the changelog, plus the /languages directory the Domain Path points at, are yours to add.
Why was my version number rejected?
Version has to be something WordPress can compare numerically — one to four dot-separated numbers, optionally followed by a pre-release suffix. Words and dates in other shapes are refused rather than written out.
Are the WordPress and PHP requirements validated?
No. Requires at least and Requires PHP are written exactly as you type them. Only the Version field is format-checked, so a typo in the minimum versions will reach the header unchallenged.
What does the licence choice change?
It sets the License line to an SPDX identifier and adds a matching License URI. Proprietary is the exception: it writes a LicenseRef identifier and no URI. GPL v2 or later is the default because the wordpress.org directory requires a GPL-compatible licence.

Related tools