Plugin Updates: Securing Download Links

March 19th, 2013

Ever since the release of the Plugin Update Checker library, one of the most common questions asked has been this: “How can I secure my download links so that only users who have purchased my plugin can download an update?” In this post I’ll try to answer that question in the context of using WP […]

Continue Reading...

WordPress Update Server

March 12th, 2013

It’s been a long time coming, but I’ve finally released an external update API server for WordPress plugins and themes. Check it out on GitHub. This is the server component to my plugin update checker and theme update checker client libraries. Features Provide updates for private or commercial plugins and themes. From the users’ perspective, the […]

Continue Reading...

8 Useful Snippets For Working With WordPress Hooks

September 25th, 2012

Add your hook before or after another hook Sometimes you need to ensure your function will get executed before or after another function that’s attached to the same hook (e.g. to fix a plugin conflict). The most reliable way to do this is to use has_action() to get the priority of the other hook and […]

Continue Reading...

How To Remove Anonymous Object And Anonymous Function Hooks

September 11th, 2012

If you’re at all familiar with WordPress development, you already know how to remove a normal hook: just call remove_action or remove_filter and pass it the hook name, the name of the hook callback you want to remove and the priority. But what if the callback has no fixed name because it’s an anonymous function […]

Continue Reading...

20+ Useful But Often Overlooked Utility Functions In WordPress

September 4th, 2012

Today I bring you 20+ handy built-in WordPress functions. Some of them you may already know and use every day, while others you’ve probably never heard of as they’re usually not mentioned in WP tutorials or even the WordPress Codex. Being aware of these functions and knowing how to use them will save you time […]

Continue Reading...

tldextract.php – Extract TLD, Domain And Subdomains From URLs

August 28th, 2012

tldextract.php is a PHP library that accurately extracts the effective top-level domain name, registered domain and subdomains from a URL. For example, you can use it to get the domain name “google” from “http://www.google.com”, or the TLD “co.uk” from “http://www.bbc.co.uk/”. Example: Introduction Most people try to do this by splitting the domain name on ‘.’ […]

Continue Reading...

Finding Related WordPress Plugins

August 15th, 2012

A few days ago, I happened upon an interesting post on the ManageWP blog discussing ways to improve the WordPress plugin repository. One of the suggestions was to add a “related plugins” feature: Both Lester Chan, with over 7 million plugin downloads to his name, and Duane Storey, a co-founder of Brave New Code, suggested […]

Continue Reading...

Automatic Versioning Of JS And CSS Files In WordPress

July 30th, 2012

If you’re a WordPress developer, this will probably sound familiar: you make a change to  one of your scripts or style sheets, reload the page you’re working on to see the result, and… everything stays the same. Of course, after a moment of confusion, you realise that you didn’t update the $version argument in your […]

Continue Reading...

Error Log Monitor

July 25th, 2012

Whether you’re using WordPress for development or simply as a blog or CMS, it is always a good idea to keep an eye on your PHP error log. As a developer, it helps you notice and fix errors in your code. As a normal user, it lets you discover plugin bugs, WordPress compatibility issues and […]

Continue Reading...

Formatting JSON With PHP

July 17th, 2012

The built-in json_encode() function in PHP puts everything on one line. For development and debugging, it can often be more useful to have properly indented, human-readable JSON that makes it easier to manually inspect the encoded data and check it for problems. Here’s a function that lets you format/pretty-print any JSON string to be more […]

Continue Reading...

List Of WordPress Plugin Frameworks

June 26th, 2012

For plugin developers desiring an easier way to perform common tasks, a little more structure in their code, or perhaps even a dash of MVC goodness, here is a list of WordPress plugin frameworks. This list is intended to be comprehensive. If you find an actively maintained plugin framework that’s not listed here, let me […]

Continue Reading...

How To Create A Table Of Contents Shortcode

June 19th, 2012

It’s time for another WordPress plugin development tutorial 🙂 In this post, I will provide a step-by-step explanation of how to create a WordPress plugin that lets the user add an automatically generated table of contents (TOC) to their posts by using a simple shortcode. The completed plugin will support the following syntax: For example, […]

Continue Reading...

Automatic Updates For Private And Commercial Themes

June 2nd, 2011

Update 2017-06-20: This library has been deprecated. Please use PUC instead. It’s more current and it supports both themes and plugins. This is a PHP library that lets you add automatic update notifications and single-click updates to any WordPress theme. It’s purpose is to be easy to integrate for developers and to provide a familiar […]

Continue Reading...

Extracting Plugin Metadata

September 15th, 2010

Have you ever dreamed of extracting useful metadata from WordPress plugins? Probably you haven’t. But if you ever need a way to parse a plugin’s readme.txt, or want to simplify metadata generation for the custom update checker, here’s a couple of utility functions that may come in handy. I originally wrote them for internal use, […]

Continue Reading...

Automatic Updates For Private And Commercial Plugins

September 2nd, 2010

Last updated on June 26, 2015. Since time immemorial, only plugins hosted in the official WordPress.org plugin directory have supported automatic updates. Now, I’ve written a PHP library that you can use to add automatic update capabilities to any plugin. Public, private and commercial plugins alike – all can now enjoy the benefits of automatic […]

Continue Reading...

Towards a Better dbDelta

July 29th, 2010

When it comes to creating and updating database tables, WordPress has what appears to be a very handy utility function – dbDelta. In theory, this function can take one or more CREATE TABLE queries, compare them to the tables already in the database and automatically figure out how to bring them up to date, adding […]

Continue Reading...

Broken Link Checker 0.9.5 Alpha

July 28th, 2010

There’s a wicked thunderstorm coming this way, so I’ll keep this short. The next major release of the Broken Link Checker plugin is nearing completion. Some of the highest voted ideas have been implemented, the user interface has been re-worked and many bugs have been fixed. Interested? Play with the alpha version, check out new […]

Continue Reading...

Adding Stuff To WordPress “Screen Options”

June 29th, 2010

The Screen Options pull-down is the perfect place for those “rarely used but nice to have” settings. It’s unobtrusive and saves screen space. Some plugins could even put all of their settings in this panel and avoid cluttering the Dashboard menu with yet another “Settings” page. While Screen Options were already present in older WP […]

Continue Reading...

Pure CSS Perversion

June 16th, 2010

Sometimes it seems that not a month goes by without another “Pure CSS Something” project. Most recently, it was the Pure CSS Twitter “Fail Whale” page that has been making the rounds on Twitter and social news sites for the last few days. Before that, we had the Opera logo made in CSS, and many, […]

Continue Reading...

How To Filter The Whole Page In WordPress

May 20th, 2010

WordPress has numerous hooks for filtering posts, comments, feed items and more, but no built-in filter that would let you intercept and modify an entire page. However, you can do that fairly easily with PHP’s output buffering functions. Today I’m going to show you how. Crash-Course In Output Buffering As the name implies, output buffering […]

Continue Reading...

Assorted Links for 27/03/2010

March 27th, 2010

Here are a number of links that I’ve recently (and not-so-recently) discovered and think might be of interest. Topics range from blogging to programming and the Singularity. 22 Linkbait  Headlines Almost Every Blogger Can Use Making the WordPress .htaccess more efficient Making Money With Open-Source (a StackOverflow thread) Harmony – Procedural Drawing Tool (can turn […]

Continue Reading...

Add Fuzzy Timestamps To Your Blog

March 2nd, 2010

I recently stumbled upon a great jQuery plugin called “timeago” that lets you easily create fuzzy timestamps (e.g. “5 minutes ago”, “about 2 months ago”, etc). So I wrote a quickie WP plugin that you can use to add this neat feature to your blog. About Basically, with this plugin you can insert a little […]

Continue Reading...

The Barest Page Templates Possible

February 25th, 2010

Some WordPress themes include custom page templates that let you add a custom layout or some nifty feature to specific pages. But sometimes you need the exact opposite – a page to be as bare, unadorned, downright plain as possible. No header, no menus, no nothing – just the HTML that you entered in the […]

Continue Reading...

How To Extract HTML Tags And Their Attributes With PHP

October 20th, 2009

There are several ways to extract specific tags from an HTML document. The one that most people will think of first is probably regular expressions. However, this is not always – or, as some would insist, ever – the best approach. Regular expressions can be handy for small hacks, but using a real HTML parser […]

Continue Reading...

Changelog Generator For WordPress Plugins

August 20th, 2009

A few months ago, WordPress.org introduced a new feature available to plugins hosted in the Plugin Directory – changelogs. Having an easily accessible changelog is certainly a usability plus, but I felt it created unnecessary work for plugin developers. Personally, I usually provide meaningful log messages (example) when uploading a new version of a plugin […]

Continue Reading...

Broken Link Checker 0.5 BETA

May 6th, 2009

The next major update of the Broken Link Checker plugin is almost done. I’ve added several new, oft-requested features and rewritten most existing functions to make them more secure and faster. However, as anyone who has at least dabbled in programming will know, lots of code changes equals lots of potential for new bugs. So […]

Continue Reading...

Calculating Readability Metrics In PHP

April 28th, 2009

Readability metrics, also known as readability formulas, are a set of algorithms that estimate the readability of text. Most tests are fairly primitive as they only take into account things like sentence length and the average number of syllables per word, but ignore deeper factors like sentence structure and semantics. Still, readability metrics can be […]

Continue Reading...

Text Classification With PHP

March 7th, 2009

Text classification is probably the most popular real-world application of machine learning and other AI techniques. This is because the adaptive spam filters that guard our inboxes, comment forms and guestbooks are basically specialized text classifiers that only deal with two categories – “spam” and “not spam”. Text categorization can also be used to detect […]

Continue Reading...

Make Your Plugin Faster With Conditional Tags

February 22nd, 2009

One of the reasons why WordPress can be slow is that it loads all active plugins on each and every page, even if some of those plugins aren’t actually used on that page. For example, an active anti-spam plugin will still be loaded even if the current page doesn’t contain a comment form (e.g. category […]

Continue Reading...

Get Google Search Results With PHP – Google AJAX API And The SEO Perspective

January 5th, 2009

If you’ve ever tried to write a program that fetches search results from Google, you’ll no doubt be familiar with the excrutiating annoyances of parsing the results and getting blocked periodically. Run a couple hundred queries in a row and bam! – your script is banned until proven innocent by entering an captcha. Even that […]

Continue Reading...