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 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: . Made to look a little more interesting:
If you're in the business of supporting WordPress in any way, it might come in handy.
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.
Used outside of WordPress, the following may be used. Usage requires Simple Cache.