was successfully added to your cart.
CorePlugin Development

The Best WordPress Plugin Development Checklist

By December 2, 2018 No Comments

The Best WordPress Plugin Development Checklist

N ow I bet your thinking that there is no logical reason why you should have or follow a checklist when creating your plugin. That logic might be the case but in reality if your reading this post I can bet your new to wordpress plugin development like me and had no idea there was such a thing. Well, I have to say that this check list has given me a great new perspective when creating my plugins because it helped me focus on what I needed to think about. In this post on “The Best WordPress Plugin Development Checklist”, i’m going to walk you through a checklist that I got from an amazing wordpress development text book that I still reference to this day.

The ONLY way to truly move forward is to focus your energy on what direction you want to go in. Checklists are simply that, a way to refocus and direct your coding attention on what matters.

The infamous wordpress plugin checklist

When starting out and creating your custom plugin, there are SOOOO many things to think about. I had no idea I was supposed to add certain spaces to my code or add an activation/deactivation hook in my files. These steps are some of the many structural elements that you need to think about and have become second nature when coding a stand out custom plugin.

After all, why do something half ass when you can do it exceptional.

Here is my checklist.

Make a unique and descriptive plugin name

  • Is the name descriptive of your plugins function?
  • Have you verified the plugin doesn’t exist in the Plugin Directory already?
  • Is this actually a plugin that is worth investing time on?

Create a unique plugin prefix for your code

  • Is the prefix unique enough to avoid and conflicts in the code?
    • For example: Webinsights is my website name that will be connected to all of my plugins so I commonly use the prefix webins_ at the beginning of my plugins.
  • Is the prefix easy to use and follow
  • Does the prefix connect to your plugin name or your name?

Create the proper plugin folder structure

  • Will your plugin need a PHP directory (folder)?
  • Will your plugin need a JavaScript directory (folder)?
  • Will your plugin need a CSS directory (folder)?
  • Will your plugin need a SASS directory (folder)?
  • Will you plugin need an images directory (folder)?

Here is an example from the Contact 7 Form Plugin **note there are a few more folders but you get the idea.

Contact 7 form plugin

Create your plugin default files

  • Create the standard index.php file
  • Create your primary file named the same as your plugin folder
  • Create your uninstall.php file for your uninstall procedures

Create your plugin header code

  • Set your plugin name as you want it displayed
  • Add a detailed description about your plugin’s main purpose
  • Set proper version layout for your plugin
  • Verify both Plugin URI and Author URI locations are set

Here is a sample from wordpress.org.

<?php
/*
Plugin Name: 
Plugin URI: 
Description: 
Version: 0.1.0
Author: 
Author URI:
Text Domain: 
Domain Path: /languages
*/

Include a license for your plugin

  • Place the license code directly below your plugin header

Create your plugin’s activation function

  • Does your plugin require a specific version of WordPress to function?
  • Does your plugin require default options to be pre-set when activated?
  
register_activation_hook( __FILE__, 'pluginprefix_function_to_run' );

Create your plugins deactivation function

  • Does your plugin require something to happen when it’s deactivated?
register_deactivation_hook( __FILE__, 'pluginprefix_function_to_run' );

Create your plugins uninstall script

  • Create an uninstall.php file
  • Include uninstall scripts in the file
// Check that code was called from WordPress with uninstallation
// constant declared

if( !defined( 'WP_UNINSTALL_PLUGIN' ) )
  exit();

// Check if options exist and delete them if present

if ( get_option( 'ch3sapi_options' ) != false ) {
  delete_option( 'ch3sapi_options' );
}

File References

  • Use the proper directory constants and functions to determine paths within WordPress and your plugin

A final word.

I hope that this plugin checklist helps you stay on track and on point when creating your custom wordpress plugin. It’s hard to code custom plugins and even harder to create plugins that are well structured and user friendly. Stay tuned for more posts in this series on wordpress plugin coding for a beginner.

Matt-image

Matthew is a Marketing Professor at Fanshawe College who specializes in technical marketing but has dabbled in many graphic disciplines from animation to graphic design and photography to web development. Besides teaching thousands of students over his various online platforms, he has created a number of companies including Eagleye Photography Inc, Behind the Curtain and FLT- Free lightroom tutorials.com. Matthew holds a Masters of Technology Entrepreneurship and Innovation from McMaster University (Ontario, Canada), a Bachelor of Education degree and Bachelor of Arts degree with Honors.

Leave a Reply