Unit Tests for WordPress Plugins – The Factory

For many plugins, writing adequate unit tests requires the creation of sample post, user, taxonomy, and other data inside of the test WordPress install. While the standard WordPress functions for creating data, such as wp_insert_post(), work just fine, WordPress provides a set helper classes called WP_UnitTest_Factory that make it exceptionally simple.

Quick Introduction to Action Hooks

Action hooks are used in WordPress to perform functions, or “actions”. They are used throughout many plugins and themes to provide an easy way for users of the theme or plugin to modify the output or the way it functions. This quick tutorial will give you a good introduction into how action hooks work.

Add Screen Options Tab to Your WordPress Plugin

You have probably noticed the Screen Options tab in the top right corner of many WordPress admin pages. This tab brings down a configuration panel that you can generally use to control what elements are displayed on the current amin page. One of the really great things about the Screen Options tab is that which…

WordPress Conditional Tags – An Overview

Conditional tags are functions used in WordPress themes and plugins to display content, or perform actions, based upon whether a certain condition is true or not. A condition can be anything; it might be a condition for whether the user is currently viewing the homepage, or a condition for whether the user is currently logged-in.…

Process Ajax Requests Correctly in WordPress Plugins

WordPress provides a set of great tools for processing ajax requests in plugins (and themes). I’m going to give you a quick example of how these tools can be used to accomplish a variety of tasks. For this example, We’ll just be using some simple alerts, but they will serve very well for demonstration purposes.

Create Custom Payment Gateway for Easy Digital Downloads

Payment gateways are “methods” of accepting payments for purchases through Easy Digital Downloads. By default, the plugin comes with two payment gateways: PayPal Standard and Manual Payment. Due to the extensible nature of the plugin, add-on payment gateways can be created, of which there are quite a few available. We can have a gateway to…

Playing Nice with the “the_content” Filter

One of the very first things people tend to learn when writing plugins is how to attach custom HTML to the bottom of their WordPress posts using the filter called “the_content”. This is good, as it is an extremely useful filter, but rarely do tutorials really explain how to use this filter well, and how…

Introduction to the WP Filesystem

I’ve spent a lot of time lately dealing with a little known, under-documented but extremely useful class in WordPress called WP_Filesystem. WP_Filesystem is used throughout WordPress to handle core/plugin/themes updates and various tasks that require writing files to your webserver. The WP_Filesystem class is a base class that has many extensions depending on what ‘method’…

Registering Custom Meta Field Types for Easy Content Types

Easy Content Types is a very powerful plugin that makes it really easy to setup custom post types, taxonomies, and meta boxes. One of great but lesser known features of the plugin is that it has an API built in to allow users to register their own custom meta field types that can be used…

How I Built the Settings System for Easy Digital Downloads

The settings system that I built for Easy Digital Downloads is something I was very happy with once finished, especially because it is very extensible, and very easy to integrate with by other developers. I decided to record an overview video that walks through how the system works.