WordPress Plugins

Create a Plugin

To create a WordPress plugin, simply create a folder and within it a file with a single line of content.

  • Navigate to the wp-content/plugins directory of your WordPress installation.
  • Create a new directory to hold your plugin. Name the directory with a unique prefix.
    Example: my-prefix_my-plugin-name
  • Inside your new plugin directory, create a .php file with the same name as the directory.
    Example: my-prefix_my-plugin-name.php.

The contents of the my-prefix_my-plugin-name.php file is at least a PHP block with a comment block inside it which defines the Plugin Name:

   Plugin Name: Awesomeness Creator

If you intend to distribute your plugin, you should add a more robust comment block:

 * The plugin bootstrap file
 * This file is read by WordPress to generate the plugin information in the plugin
 * admin area. This file also includes all of the dependencies used by the plugin,
 * registers the activation and deactivation functions, and defines a function
 * that starts the plugin.
 * @link              http://something.com/to-my-source-code/like-maybe-at-github
 * @since             1.0.0
 * @package           My-prefix_my-plugin-name
 * @wordpress-plugin
 * Plugin Name:       Snippets
 * Plugin URI:        http://something.com/to-my-source-code/like-maybe-at-github
 * Description:       This is a short description of what the plugin does. It's displayed in the WordPress admin area.
 * Version:           1.0.0
 * Author:            John Doe
 * Author URI:        http://something.com/to-my-author-profile
 * License:           GPL-2.0+
 * License URI:       http://www.gnu.org/licenses/gpl-2.0.txt
 * Text Domain:       my-prefix_my-plugin-name
 * Domain Path:       /languages