If you’ve ever installed a WordPress plugin from the plugin store, you’d know that after you install the plugin, you need to activate the plugin.
Likewise, for your own plugins, you need to activate them.
The first thing we want to do is go into the plugins folder in our WordPress folder. The path you’d need to look for would be
${Your-Wordpress-Folder-Name}/wp-content/plugins
Now lets create a folder named my-first-plugin with the two PHP files inside it, index.php
and my-first-plugin.php
Inside the index.php file, we just want to leave it blank
<?php
// silence is golden
Header fields tell WordPress that our file involves a plugin, and gives us information about the plugin.
Here are the following headers we’re going to add to our plugin
The name of our plugin. For this plugin, I’m just going to name it My First Plugin
<?php
/**
* @package My First Plugin
*/
/*
Plugin Name: My First Plugin
*/
Describes our plugin, we can just state what our plugins purpose is for
<?php
/**
* @package My First Plugin
*/
/*
Plugin Name: My First Plugin
Description: This is my first attempt on writing a custom Plugin for this amazing tutorial series.
*/
What version of your plugin do you want to indicate we’re on. I’m going to just set mine as 1.0.0
Name of the author of the plugin, I’m going to just use my own
The link to the authors website, which I will also use my own site for this. If you don’t have your own website, or just don’t want to add your own site, feel free to omit this.
According to WordPress.org’s guidelines,
So I’m going to set the license to be GPLv2 or later
<?php
/**
* @package My First Plugin
*/
/*
Plugin Name: My First Plugin
Description: This is my first attempt on writing a custom Plugin for this amazing tutorial series.
Version: 1.0.0
Author: Victoryflame
Author URI: victoryflame.com
License: GPLv2 or later
*/