HOW TO: develop your own WordPress plugin

Categories How To

If you’re interested in starting your own business or blog, chances are you’ve heard of WordPress. It’s a flexible platform that allows you to customize it to your own liking. A lot of hosting companies allow WP integration, allowing you to purchase your own domain and have your blog hosted there.

After setting up your site, you’ll find that plugins make the entire process easier and more seamless. There are many plugins out there, but maybe the one you’re looking for doesn’t exist. As the old saying goes, if you want to do something right, you’ve got to do it yourself. Here are a few steps that you should take to develop your own WordPress plugin.

Choose Your Tools

WordPress uses TinyMCE text editor for their site. Though the only tool you need is a text editor, you’re not stuck with this one. Many users think the editor doesn’t provide enough buttons rendering it too basic. TinyMCE Advanced, Ultimate TinyMCE, CKEditor, and Raw HTML are all great alternative text editors. Each of these editors has a list of their own benefits.

TinyMCE Advanced imports CSS classes from your theme’s style sheet into the drop down menu and has a real HTML editor. Ultimate TinyMCE has advanced features for images.

If you want to move away from the TinyMCE editors, then CKEditor is a good option for you. It has high ratings in the directory and is updated regularly. Raw HTML is for people who love to code. It allows you to use HTML, CSS, and JavaScript to create and update your Plugin.

Setting Things Up Locally

First, you’ll need to get WordPress on your machine, so go ahead and install that, and you need to get OSCommerce, so set that up as well. You’ll store your plug-in in the wp-content/plugins folder. Normally, plugins will require the code to be in a single PHP file. To keep everything nice and organized, create a file for content that you’ll import from OSCommerce.

Working With the Site

You’ll need to create the plugin file. Name it something unique so it won’t get lost on your computer. If you check the plugin section on WordPress, you’ll find the header. Here, you’ll be able to name the plugin, change the description, etc. A sample header will run 10 to 12 lines, but it must be included, otherwise WP won’t acknowledge your plugin. Here’s a sample header.



* Plugin Name: Name Of The Plugin

* Plugin URI: http://URI_Of_Page_Describing_Plugin_and_Updates

* Description: A brief description of the Plugin.

* Version: The Plugin’s Version Number, e.g.: 1.0

* Author: Name Of The Plugin Author

* Author URI: http://URI_Of_The_Plugin_Author

* License: A “Slug” license name e.g. GPL2


Creating the Code

To some, this will be the most difficult part, and to others, it’ll be a piece of cake. You will need, at the very least, basic PHP skills. With those PHP skills, you’ll use action hooks, which are callback functions, to get WordPress to execute certain processes. With action hooks, your code will run at a certain specific moment.

For example, you can add an action when a user reaches a certain part of the page with the add action hook. There are literally hundreds of action hooks, and you can discover them in the WordPress Codex. The list provided is more of a guideline to action execution order and not concrete. However, you’ll start to see which actions you need to set to show just the first time or if they need to be called multiple times. Depending on the themes and plugins you choose, will determine the varying actions called.

Develop an Administration Page

Your plugin will need to have some sort of administration name so people can edit it to their liking. You’ll need to have a few configurable parameters. You’ll need to set up the database username, password, and host so people can connect to your plugin and get whatever data they need. You’ll also need information about the store, like its URL and the location where the images are stored.

After outlining what to configure, you should implement it by creating a menu item to get access to the page. After you create the menu item, place it in the settings menu with the action hook feature. There’s an action hook that gets called on when the basic menu has been generated, so that’s a great place to add it in so your new menu item will show up.

Internalize Your Plugin

You’ll want to consider internalizing your plugins so that it can be localized to translate text by the software into different languages. According to, because WordPress is used globally, internalization and localization is built into its structure including Plugins. WP highly recommends you internalize your Plugin so global users can localize it.

Update Your Plugin

Over time, you’ll want to add features and fix the occasional bugs with your Plugin. After everything is committed and the new version of your Plugin works, be sure to test your Plugin on all WordPress versions your Plugin supports.

Test all your features and not just the new ones to make sure you didn’t unintentionally break some of the older functions. You’ll also want to change the version number in the header comment and the ‘Stable tag’ field, and add a new sub-section in the ‘Changelog’ section. Finally, commit all these changes.

You can always see your plugin’s old versions on the Plugin’s page on If you’re having problems, look for the answer in this Plugins directory.

This is literally just the tip of the iceberg to creating a WordPress plugin. You’ll still need to handle the data and design the user function. It’ll take a lot of trial and error, but when things actually work like they’re supposed to, it’s incredibly rewarding. According to WSU, a university known for its School of Business and web development community, approximately 20 percent of the Web is built upon WordPress. A large part of why WordPress is so prevalent is because its low barrier to entry and readily available toolset. You’re missing your audience if you don’t have a WordPress site already.

Have you developed a WordPress plugin? If so, what did you develop? Leave us a comment below and let us know, as well as what tutorials you used!

header image courtesy of Tyler Somers

Catalin is the founder of Mostash – a social marketing boutique – and he’s always happy to share his passion for graphic design & social media.