Home How To Create A WordPress Plugin Wordpress How To Create A WordPress Plugin How To Create A WordPress Plugin

How To Create A WordPress Plugin

March 17, 2021
How To Create A WordPress Plugin

WordPress plugins are PHP scripts that alter your website. The changes could be anything from the simplest tweak in the header to a more drastic makeover. (This article has been checked and updated on March 15, 2021.)


To create a plugin, all you need to do is create a folder and then create a single file with one line of content. Navigate to the wp-content/plugins folder, and create a new folder named plugin-name. Inside this new folder, create a file named index.php. Open the file in a text editor, and paste the following information in it:

   Plugin Name: Plugin Name
   Plugin URI: https://projectsengine.com
   Version: 1.1.1
   Author: Projects Engine
   Author URI: https://projectsengine.com
   License: GPL2

Only the plugin’s name is required. But if you intend to distribute your plugin, you should add as much data as possible. With that out of the way, you can go into the back end to activate your plugin.

Plugins are self-contained modules that exist outside the WordPress core code so that they can be modified and updated as needed without affecting the website’s overall structure and theme.

Plugins consist of either a single file or multiple files written in the PHP programming language, which is also the language of the WordPress core code. A typical plugin contains four elements, including:

  • Actions, which describe specifically what action is to happen
  • Filters, which establish variables that can be modified when an action is triggered
  • Shortcodes, user-facing bits of code that are inserted into the site’s visual editor to insert a specific kind of action, such as a slideshow
  • Widgets, areas on the website home page that can be individually manipulated to get the desired plugin effects.

Depending on its purpose, a plugin might also contain images, style sheets, or bits of JavaScript.

Plugins add extra functionality to your WordPress site over and above what comes with WordPress core. Everything from a booking calendar or animated slider to a full-featured learning management system or online marketplace—you can add them all to your site with plugins.

Free and paid WordPress plugins

If you want to add some specific features to your website, there are plenty of places you can buy or download plugins. The WordPress plugin directory includes thousands of free plugins that’ll help you create the site you need. But sometimes you might need to code your own plugin. This can be more efficient than using a third-party plugin, as you might only need a part of the code provided by those. It also means you can develop a plugin that meets your needs more precisely, or you can customize an existing plugin to adapt it for your site.

What do you need to make a plugin?

To build your own plugin and run it on your WordPress site, you’ll need:

  • a code editor
  • a development WordPress installation with a copy of your live site for testing

Don’t test your plugin on your live site until you know it works!

Was this article helpful?