How To Create Your First WordPress Plugin

Plugins extend and expand the functionality of WordPress.There are tens of thousands of plugins that you can use to install to your WordPress site. In this article, we will introduce how to create a basic WordPress plugin.

1. Create a PHP file.

You can create a simple empty notepad text document and change the extension from .txt to .php when you save it.

2. Add this snippet to your txt file

/**

 * Plugin Name: Your_Plugin

 * Plugin URI:  https://yourwebsite.com

 * Description: Your first wordpress plugin

 * Version:     1.0

 * Author:      WordPress Contributors

 * Author URI:  https://yourwebsite.com

 * Text Domain: your first wordpress plugin

 * Domain Path: /languages

 

*/

After you save the notepad text document with .php extension, you can upload it to your hosting. For example, you can save it as my_first_plugin.php

3.Upload it to public/wp-content/plugins

You can use FTP software to upload the document “my_first_plugin.php” to the folder Public/wp-content/plugins.

If you are using Cpanel, you can upload it directly by Cpanel. It’s easy. See the picture below.

4. Go to The WordPress dashboard, go to plugins and activate the plugin you just upload.

You can activate it. After the activation of your first plugin, you can see it in your plugin list. You can see the custom plugin name, custom plugin description, version, author, and link to the author’s website. However, this is an empty plugin. If you want to add some features to the plugin, you need to add specific code to the PHP document you just upload.

Leave a Comment