Standard WordPress Plugin Structure

·

·

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>';
    }
});
ParameterRequiredDescription / PurposeExample
Plugin Name✅ YesThe display name of your plugin. Shown in the Plugins list.Plugin Name: My First Plugin
Plugin URI❌ OptionalURL for more details (docs, GitHub, or official site).Plugin URI: https://example.com/my-first-plugin
Description✅ YesShort summary of what the plugin does. Appears under the name in Plugins list.Description: A simple Hello World plugin.
Version✅ YesCurrent version of the plugin. Follows semantic versioning (major.minor.patch).Version: 1.0.0
Author✅ YesName of the plugin creator (person or company).Author: John Doe
Author URI❌ OptionalLink to the author’s website or profile.Author URI: https://example.com
License⚠️ RecommendedLicense type (WordPress requires GPL-compatible).License: GPL-2.0+
License URI⚠️ RecommendedLink to the license text.License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain⚠️ RecommendedUnique identifier for translations. Usually matches plugin slug.Text Domain: my-first-plugin
Domain Path❌ OptionalFolder 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❌ OptionalControls where updates come from. Set to false to prevent WP.org updates.Update URI: false