A plugin adds functionality. Create a folder inside wp-content/plugins and a main PHP file with a header:
my-first-plugin/
└─ my-first-plugin.php
my-first-plugin.php
<?php
/**
* Plugin Name: My First Plugin
* Plugin URI: https://example.com/my-first-plugin
* Description: A simple "Hello World" plugin for learning WordPress plugin development.
* Version: 1.0.0
* Author: author-name
* Author URI: https://example.com
* License: GPL-2.0+
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: my-first-plugin
* Domain Path: /languages
* Requires at least: 6.0
* Requires PHP: 7.4
* Update URI: false
*/
// Activation hook (runs once on activation)
register_activation_hook( __FILE__, function () {
add_option( 'mfp_activated', time() );
});
// Simple admin notice
add_action( 'admin_notices', function () {
if ( get_option( 'mfp_activated' ) ) {
echo '<div class="notice notice-success"><p>My First Plugin is active 🎉</p></div>';
}
});
| Parameter | Required | Description / Purpose | Example |
|---|---|---|---|
| Plugin Name | ✅ Yes | The display name of your plugin. Shown in the Plugins list. | Plugin Name: My First Plugin |
| Plugin URI | ❌ Optional | URL for more details (docs, GitHub, or official site). | Plugin URI: https://example.com/my-first-plugin |
| Description | ✅ Yes | Short summary of what the plugin does. Appears under the name in Plugins list. | Description: A simple Hello World plugin. |
| Version | ✅ Yes | Current version of the plugin. Follows semantic versioning (major.minor.patch). | Version: 1.0.0 |
| Author | ✅ Yes | Name of the plugin creator (person or company). | Author: John Doe |
| Author URI | ❌ Optional | Link to the author’s website or profile. | Author URI: https://example.com |
| License | ⚠️ Recommended | License type (WordPress requires GPL-compatible). | License: GPL-2.0+ |
| License URI | ⚠️ Recommended | Link to the license text. | License URI: https://www.gnu.org/licenses/gpl-2.0.html |
| Text Domain | ⚠️ Recommended | Unique identifier for translations. Usually matches plugin slug. | Text Domain: my-first-plugin |
| Domain Path | ❌ Optional | Folder where translation files (.mo/.po) are stored. Default: /languages. | Domain Path: /languages |
| Requires at least | ❌ Optional (recommended on WP.org) | Minimum WordPress version required. | Requires at least: 6.0 |
| Requires PHP | ❌ Optional (recommended) | Minimum PHP version required. | Requires PHP: 7.4 |
| Update URI | ❌ Optional | Controls where updates come from. Set to false to prevent WP.org updates. | Update URI: false |
