WordPress Plugin Generator

Our Free Online WordPress Plugin Generator allows you to generate a simple WordPress plugin based on code snippet that you have. Please, check the php syntax. Add prefixes to the functions and classes to ensure they are unique.

This WordPress plugin generator packages your well written and tested php code into into a WordPress plugin that you can later install on your or client’s WordPress site.

Important: By using this tool, you acknowledge that you have read, understood, and agree to be bound by the terms and conditions outlined in this disclaimer.


If you have suggestions or run into an issue contact us

Example & How to use the tool?

This example creates a custom shortcode : [my_company_hello_world] which outputs some text.
Please prefix the Plugin Name with your company name so your custom plugins are listed one after another and not at random positions in WordPress > Plugins section. Again make sure the php code is valid.

// Add a shortcode that outputs "Hello, World!"
function my_company_hello_world_shortcode() {
    return 'Hello, World!';
}
add_shortcode('my_company_hello_world', 'my_company_hello_world_shortcode');

What is a WordPress Plugin?

A WordPress plugin is a piece of software that extends the functionality of a WordPress site. It allows you to add features and functions without modifying the core WordPress files. Plugins can range from simple modifications to complex applications.

What are the Minimum Requirements for a WordPress Plugin

At its core, a WordPress plugin requires only a few basic elements which can be in one single file:

  • A Plugin Folder: This is where all your plugin files reside. The folder name should be unique to avoid conflicts with other plugins.
  • A Main Plugin File: This file contains the plugin’s header comment and the main code. It’s typically named after the plugin itself (e.g., my-plugin.php).
  • Plugin Header Comment: This is a PHP comment block at the top of the main plugin file that provides metadata about the plugin. WordPress uses this information to display the plugin in the admin interface.

Here’s a simple example of a main plugin file with the required header comment:

<?php
/*
Plugin Name: My Awesome Plugin
Plugin URI: https://wpsandbox.net/tools/wp-plugin-generator
Description: A short description of what the plugin does.
Version: 1.0.0
Author: Your Name
Author URI: https://wpsandbox.net
License: GPL2
*/

// Your plugin code starts here you'd use add_action('init', 'my_awesome_plugin_init');

It is really important to use your own prefix for the functions and classes to avoid conflicts with other plugins. In PHP you can’t have two functions with the same name. As soon as the 2nd one is encountered the site crashes because php doesn’t know which one to call later on.

A Breakdown of Plugin Header Fields

They are stored in a key:value and wrapped in a php comment so they are normally ignored by php but WordPress reads that info to get some interesting information about the plugin.

  1. Plugin Folder:
    • Create a new folder in the wp-content/plugins directory. Name it something unique, like my-awesome-plugin.
  2. Main Plugin File:
    • Inside your plugin folder, create a PHP file (e.g., my-awesome-plugin.php). This file will contain the header comment and the main logic of your plugin.
  3. Plugin Header Comment:
    • The header comment is crucial as it tells WordPress about your plugin. It should include the following information:
      • Plugin Name: The name of your plugin.
      • Plugin URI: A link to the plugin’s homepage.
      • Description: A brief description of the plugin’s functionality.
      • Version: The current version of the plugin. It should be in the form of 1.0.0
      • Author: Your name.
      • Author URI: A link to your website.
      • License: The license under which the plugin is released. Normally, it’s GPL just like WordPress

Why should you use a custom plugin for your code?

The custom code or fixes won’t depend on your current theme and when you change it it will still work.
the performance would be the same as having the code in the functions.php file
It is easier to disable, update, or reinstall as needed if it doesn’t work.
Ideally, you should have code/plugins grouped to do a single task and do it well.
Yes. This will increase the number of plugins but it won’t affect the performance because if the code is code is efficient regardless where you install it it will take the same amount of CPU or memory.

The your tool generated the WordPress plugin now what?

Your next steps are:

  • Download the plugin on your computer. It’s a zip archive file
  • Open it on your computer and visually inspect the php file that’s in the folder. Just in case. We try to test our tools a lot but a glitch may pop up from time to time. It’s just inevitable.
  • If the plugin is broken WordPress won’t activate it. Remember you must test your code for php errors and to ensure functions have prefixes to avoid conflicts with other functions from themes or plugins or WordPress itself.
  • Activate the plugin
  • Enjoy!

How will this Custom Generated Plugin be Updated?

This is a great and a valid question. The generated plugin must be updated manually by uploading a newer version with the same package and file name and override the existing one. Automatic updates are not possible because the plugin is not hosted in the official WordPress plugin director and also doesn’t have an updater because this requires backend as well.

How long will the plugin be available for Download?

The generated plugin will be available for download for a few hours until it is automatically deleted.

Who owns the plugin/code?

You do

Resources

WordPress Plugin readme validator