Plugins

WordPress Plugins

Plugins are ways to extend and add to the functionality that already exists in WordPress. The core of WordPress is designed to be lean and lightweight, to maximize flexibility and minimize the amount of code. Plugins offer custom functions and features so that each user can tailor their website to their specific needs.

WordPress Plugins Development

There is one cardinal rule in WordPress development: do not touch WordPress core. This means that you do not want to edit core WordPress files to add functionality to your website because WordPress overwrites core files with each update. Any functionality that you want to add or modify should be done using plugins.

WordPress plugins can be as simple or as complicated as you need them to be, depending on what you want to do. The simplest plugin is a single PHP file. The plugin PHP file just needs a Plugin Header, a couple of PHP functions and some hooks to attach your functions to it. The Hello Dolly plugin is an example of such a plugin. To be more precise, the Hello Dolly plugin is made with only 2 files, hello.php and readme.txt

All plugins contain a main PHP file with the Plugin Header and almost all plugins have a readme.txt file as well.

Plugin Header

As plugin header requirements, the main PHP file should include a header comment that tells WordPress that a certain .php file is a plugin and provides information about that same plugin. At a minimum, the header comment must contain the Plugin Name:

1  <?php
2  /**
3  Plugin Name: YOUR PLUGIN NAME
4  */

ReadMe Header

As readme header requirements, the readme.txt file consists of the following information, generally speaking:

 1  === Plugin Name ===
 2  Contributors: (this should be a list of wordpress.org user id's)
 3  Donate link: https://example.com/
 4  Tags: tag1, tag2
 5  Requires at least: 4.7
 6  Tested up to: 5.4
 7  Stable tag: 4.3
 8  Requires PHP: 7.0
 9  License: GPLv2 or later
10  License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
12  Here is a short description of the plugin. This should be no
    more than 150 characters. No markup here.

MyPlugin, your first plugin!

MyPlugin is active!

Another example of a very simple plugin is our MyPlugin, available to download after providing your eMail address.