In this article I want to show you how to create your own WordPress plugin in a few simple steps.
2 years ago I programmed my first WordPress plugin for the Divi Theme. This is the Divi Filter plugin, which is still in use today on several thousand websites worldwide.
Creating a WordPress plugin isn’t as hard as you might think. Anyone who knows the basics of PHP or JavaScript and can customize a theme can create a plugin.
Why should you create a WordPress plugin?
If you’re like me, you’ve probably added functions to your theme instead of creating a plugin. There are many cases where that’s fine, but there are also cases where it’s better to add custom functions in a plugin.
For example, imagine that you change the theme. Then your additional functions will be deleted, even a child theme will not help you.
Create your first WordPress plugin in 4 easy steps
This is no joke. You can create a WordPress plugin in just 4 simple steps.
Step 1: FTP to your website
First, you need to access your website with an FTP program of your choice (I use FileZilla (Windows)). If you are not familiar with FTP, you can also use the file manager of your WordPress hosting.
Step 2: Navigate to the WordPress Plugins folder
Once you have accessed your website via FTP, you need to navigate to the WordPress plugins folder.
This is at wp-content/plugins.
Step 3: Create a new folder for your plugin
Now that you’re in the plugins folder, it’s time to create a folder for your plugin.
Create a new folder and give it a unique name with lowercase letters, e.g. my-first-plugin.
Step 4: Create the PHP file for your plugin
Next, you need to create the main file for your plugin. To do this, create a PHP file in your new plugin folder and give it the same name as the folder: my-first-plugin.php. After that, open the main file of your plugin and start editing it.
Every WordPress plugin needs some information in the header file. You can copy them from below and replace them with your information.
<?php
/*
Plugin name: My first plugin
Plugin URI: https://danielvoelk.de/
Description: My first plugin
Version: 1.0.0
Author: Daniel Völk
Author URI: https://danielvoelk.de/
*/
That’s it! You’ve just completed the minimum number of steps required to create a WordPress plugin. Now you can activate it in the WordPress admin panel and enjoy its fame.
If you have any questions, please feel free to contact me.
Upload your WordPress plugin to the repository
If you think your plugin will help other web designers, you can upload the plugin to the WordPress repository. You can find information about this on the WordPress page.