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
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.
- create the plug-in
- test the plug-in
- add security measures
- add the support files
- create a screenshot image
- create the readme.txt file
- create an official plug-in landing page
- submit your plug-in to the public subversion repository
- promote your plug-in
- 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:
- You will have a centralized location for your plug-in and updates on a very high traffic web site.
- 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).
- You will get more first-time visitors to your own development blog.
- 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.
- Users can easily rate your plug-in for version compatibility and 5-star-ranking.
- You can easily track download statistics.
- Extensive version update maintenance is available. In fact, the repository is a stable backup location for your files.
- Plug-ins hosted at the official directory are perceived to have a higher degree of trustworthiness.
- 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.
- 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.
- Writing a Plugin
- Plugin Resources
- Plugin API
- Dashboard Widgets API
- Widgets API
- Database Description
- The Loop
- Action Reference
- Filter Reference
- Function Reference
- I18n for WordPress Developers
- Settings API
- Shortcode API
- Template Tags
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.
- Developer Center Overview
- Plug-in Addition Request form
- Using Subversion
- Developer FAQ
- readme.txt boilerplate
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
In our next article, we'll continue with Plug-in Development Fundamentals.