Creating a plugin in WordPress is very simple.
Step 1 – Create a directory in the wp-content/plugins directory (Ex. MyFirstPlugin)
Step 2 – Create a .php file in the the new directory. The root of the file name has to match the directory name. (ex. MyFirstPlugin.php)
Step 3 – Add the plugin header to the plugin file:
<?php
/*
Plugin Name: <name of your plugin. Ex. MyFirstPlugin>
Plugin URI: <link to your plugin documentation, optional>
Description: <plugin description that will appear in the WordPress Dashboard>
Version: 1.0
Author: <Your name>
Author URI: <link to the authors website, optional>
Text Domain: <string that describes text domain for this plugin, optional>
Domain Path: /languages, <optional>
*/
Step 4 – Add your custom code below the plugin header.
Step 5 – Activate the plugin in the WordPress Dashboard.