Skip to content

Instantly share code, notes, and snippets.

@julienbourdeau
Created January 26, 2014 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save julienbourdeau/8633521 to your computer and use it in GitHub Desktop.
Save julienbourdeau/8633521 to your computer and use it in GitHub Desktop.
This function will give you the last stable version of WordPress. It fetches the home page of wordpress.org and return the version number from the download buttons. Curl is required.
function get_wordpress_last_version_number() {
$link = `curl http://wordpress.org | grep '<a class="button download-button button-large"'`;
preg_match_all("/\<a.*href=\"(.*?)\".*?\>(.*)\<\/a\>+/", $link, $matches, PREG_SET_ORDER);
$last_version = str_replace("Download&nbsp;WordPress&nbsp;", '', $matches[0][2]);
return $last_version;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment