Easy WordPress Plugin Development (Part 1)

by on May 8, 2011

In this tutorial series, we'll progress through the entire WordPress plugin development process. We'll create a useful (but basic) plugin, add security measures, submit it to the WordPress repository, and promote it.

You can access the linked table of contents for the entire series below. The plug-in we'll develop is one that's currently available in the WordPress Plugin Directory. It's our WCS QR Code Generator. This was my second official plugin.

Over the years, I've written scores of plugins for our favorite blogging platform. But, most of these were proprietary for clients or for personal implementation. With this blog, however, one goal is to develop quite a number of public plug-ins. In fact, a good portion of the source code available on this website is actually intended for prototype plugin creation.

But, let me assure you that beyond the basic PHP coding, there is a noteworthy learning curve in preparing an existing plugin for submission. First, there's the complexity of a carefully crafted readme.txt file. Further, there's the added multi-step task of submitting your creation to the public Subversion Repository.

We'll explain it all in a step-by-step fashion. Moreover, you may want to bookmark this page (or others in this series) as a development/submission reference.

Table of Contents for this Tutorial
    Toggle Article Details

  1. Introduction: Plug-in Development Overview  (you are here)
  2. Plug-in Development Fundamentals
  3. Our Plug-in's Primary File Source Code
  4. Implementing Dashboard Admin Pages
  5. Additional Plug-in Considerations
  6. Plug-in Testing Techniques
  7. Finalizing Our Plug-in
  8. (coming soon) Submitting Your Plug-in to WordPress
  9. (coming soon) Promoting Your Plug-in's Future
  10. (coming soon) Advanced Plug-in Techniques

Overview of the Steps Involved

For any WordPress user, plug-ins are essential to customization of the basic installation. Plus, they allow those with little or no programming skills to extend the functionality of their blog.

Plug-ins come in all shapes and sizes; and, there is a plug-in that does just about anything you can imagine for WordPress. In fact, there are more than 14,000 plug-ins available in the official repository.

Developing robust WordPress plug-ins definitely requires a strong working knowledge of both PHP and the WordPress Platform. However, you can certainly create very useful and much appreciated plug-ins with a more intermediate understanding of these platforms. In fact, coding smaller plug-ins can be pleasantly educational.

Essentially, plug-in development is a 10-step process. Some of these steps are rather easy; others are notably more complex. We'll cover each step rather thoroughly … though not exhaustively.

  1. create the plug-in
  2. test the plug-in
  3. add security measures
  4. add the support files
  5. create a screenshot image
  6. create the readme.txt  file
  7. create an official plug-in landing page
  8. submit your plug-in to the public subversion repository
  9. promote your plug-in
  10. support your plug-in with updates
Why You Should Use the WordPress Plug-in Directory

Since the submission process for plug-ins involves a learning curve … and is considered to be an unnecessary chore by many folks, you might wonder why you should go through the arduous process. Well … here are a few benefits:

  1. You will have a centralized location for your plug-in and updates on a very high traffic web site.
  2. You will have extremely high exposure for your plug-in and your website. This will likely be your one of your first backlinks on a top-100 website (that isn't a search engine).
  3. You will get more first-time visitors to your own development blog.
  4. Many bloggers and developers in the WP community visit the official Plugin Directory. In fact, the directory is also available for multi-site super-admins (network administrators) from the Dashboard.
  5. Users can easily rate your plug-in for version compatibility and 5-star-ranking.
  6. You can easily track download statistics.
  7. Extensive version update maintenance is available. In fact, the repository is a stable backup location for your files.
  8. Plug-ins hosted at the official directory are perceived to have a higher degree of trustworthiness.
  9. With many more bloggers downloading your plug-in through the official repository, you greatly increase the probability of generating revenue through donations. And, of course, you will enjoy a spike in revenue from your affiliate marketing campaigns as first-time visitors return for more of your relevant and useful information.
  10. You increase the odds that other web sites will link to your website … or to your download page. The traffic generated by this reciprocity precipitates numerous direct and indirect benefits for your website.
Official Plug-in Development Documentation

In this tutorial, we'll just cover the fundamentals of actual plug-in PHP coding … with a real world example. Moreover, the following official documentation offers a lot of very useful information. Plus, it covers a variety of plug-in development topics … far beyond what we'll need for the basic plug-in we'll be creating.

Official Plug-in Submission Documentation

This tutorial is not intended as a replacement for the official WordPress submission documentation. It's actually a supplement intended to augment the missing details in those official docs. Hopefully, you'll find our coverage useful.

Official Documentation:

  1. Developer Center Overview
  2. Plug-in Addition Request form
  3. Using Subversion
  4. Developer FAQ
  5. readme.txt boilerplate
  6. readme.txt Validator
Choose a Sandbox for Code Development

Choosing where to develop and test your plug-in is a key step. In the context of software development, a sandbox is a testing environment that isolates untested code changes, inchoate code development, and outright experimentation from the production environment and/or source code repository.

  1. Use your primary website. Many coders employ this development option. However, you certainly run the risk of temporarily crashing your site and, thereby, frustrating or loosing visitors.
  2. Use a secondary website on the same installation. This is an easy option to use. Simply, create another website after enabling the 3.0+ multi-site capability.
  3. Use a secondary website on another server. If you have a completely separate domain that you're not using, you'll have a lot of latitude for coding and experimentation before bringing the code back to your primary site.
  4. Install Apache, MySQL, PHP, and WordPress on your local computer. You can actually do this (create your own private LAMP server) regardless of your primary operating system. Check out XAMPP. It's free and you can run it without having to purchase a domain name (or use a DNS). Plus, it's available for the four major operating systems: Windows, Linux, Mac OS X, and Solaris. This is an all-in-one option except you'll need to download and install WordPress separately.
  5. Install WordPress with the Microsoft Web Platform Installer on your local Windows computer. Check out the WPI Launcher. It's also free and you can run it without having to purchase a domain name. Plus, you can easily install lots of additional web applications with this all-in-one option from the Windows Web Application Gallery … OR … directly from within the program itself.
  6. Install WordPress (along with Apache, MySQL, and PHP) on a USB stick. This highly portable option is explained at WordPress @ T2. The download link, however, is now at a new location: MoWeS Portable II Core. This is also an all-in-one package installation.


Continue Reading…

In our next article, we'll continue with Plug-in Development Fundamentals.


Share This Article: “Easy WordPress Plugin Development (Part 1)”

(Also Available: Press CTRL+D to Bookmark this Page)


Share Your Thoughts  12 Responses to “Easy WordPress Plugin Development (Part 1)”
  1. 1
    Jeriff Cheng says:

    Facebook,Twitter,Google plus one Share Buttons V1.2 Released!
    Add Stumbleupon,Linkedin,Digg,Google Buzz share buttons.All buttons can show counts!

  2. 2
  3. 3
  4. 4
    Roes Wibowo says:

    Very-very useful.. Big thanks… :)

  5. 4.1
    Don Waite says:

    Great plugin tutorial collection.


Check out what others are saying about this post...
  1. [...] Introduction: Plug-in Development Overview Overview of the Steps Involved · Why You Should Use the WordPress Plug-in Directory · Official Plug-in Development Documentation · Official Plug-in Submission Documentation · Choose a Sandbox for Code Development [...]

  2. [...] Easy WordPress Plugin Development » [...]

Share Your Thoughts

(Some editor features are restricted unless you're logged in.)

(When replying to a specific comment, your browser may require Shift+Enter instead of just Enter.)

(get a gravatar)

Notify me of followup comments via e-mail. You can also subscribe without commenting.