Step 1 – Name Your WordPress Plugin
Steps to Create a WordPress Plugin
- Name Your WordPress Plugin
- Isolate Your Plugin From Other Plugins
- Organize Your Plugin Files
- Define Directory Paths
- Load Plugin Files
- Directory Structure
- Plugin Activation, Plugin Deactivation, and Plugin Uninstallation
- Essential Plugin Files
- Security: Protect Plugin Files
- Plugin Hierarchy
Think of what you want to do with your plugin and think of a simple name to identify that functionality. This will be the name of your plugin.
For the sake of this tutorial, the plugin name will be “MBE Plugin” with a plugin slug of “mbe-plugin”.
Create a Directory For Your WordPress Plugin
Once you have a name, you need to create a “directory-safe” name of your plugin. This can be referred to as a “plugin slug”. This is something that will be commonly used throughout the development of your plugin. Create a sub-directory in
./wp-content/plugins. This will be the main directory which contains all of the functionality specifically for your plugin.
It should look like this:
This is what mine looks like:
Create the Main WordPress Plugin File
Now that you’ve created a directory to store all of the files which will be related to your plugin, it’s time to create the main plugin file. This is the file which WordPress will look for, in order for WordPress to provide an interface in the back-end for you and/or your users to “activate”, “deactivate” , or “uninstall” your plugin.
This back-end interface would be located at:
Create a file named
index.php and place it in the root of your plugin directory. (
Provide Basic Plugin Information
index.php and create a block comment. At a minimum, you must provide a Plugin Name attribute to this block comment.
Plugin Name: Your Plugin Name
I like to provide as much information about my plugin as possible; I think you should as well.
Here’s an example:
Plugin Name: MBE Plugin
Plugin URI: https://www.michaelbrentecklund.com/wordpress/plugins/mbe-plugin/
Description: Just another skeleton WordPress plugin.
Author: Michael Ecklund
Author URI: https://www.michaelbrentecklund.com/
If you log into the back-end of your WordPress website and navigate to
your-domain.com/wp-admin/plugins.php, you’ll see your plugin is now visible in the list of plugins. At this point, if you were to activate your plugin… Absolutely nothing would happen, because your plugin has zero functionality. All you’ve done this far is essentially tell WordPress about your plugin, but it’s a step in the right direction