and like us on FB

This article will show you how to retrieve the total WordPress download count and display it in a WP post or page with shortcode. Of all the excellent resources and APIs that WordPress makes available to their community, I couldn’t find one that returned a total count. Some time back we had a need for it, so we wrote a quick function that would scrape the WordPress website and cache the result. While a regular expression is never a good idea for parsing HTML content – it works (until it doesn’t, of course).

The Result

The result will display the download count for the current version as extracted from this page on the WordPress website. The shortcode of [wpdl] will return the following: 6,761,234. Made to look a little more interesting:

6,761,234

If you’re in the business of supporting WordPress in any way, it might come in handy.

WordPress Shortcode

Copy and paste the WordPress function into your theme's functions.php file or, if you sensibly have one installed, your custom functions plugin. You may optionally download and install our plugin from the bottom of of the page.

If you require shortcode to work in a sidebar widget, you'll have to enable the functionality with a filter. If you're using our custom functions plugin, you'll have that feature enabled by default.

PHP Function

Used outside of WordPress, the following may be used. Usage requires Simple Cache.

Download

Title: Display the Number of Total WordPress Downloads
Description: Displays a total count of WordPress downloads. Sourced from the WP website.
Download: Shortcode (V0.2) | WP Plugin (V0.2) | PHP Code (V0.1)

Shortt URL for this post: http://shor.tt/1qcu