Get WordPress Current Version Number with PHP

Today I wrote a great little PHP script that fetches the Current release number of WordPress. It goes like this:

<?php
//WP Version checking by Ian L. of Jafty.com:
$url=’https://api.wordpress.org/core/version-check/1.7/’;

$contents = file_get_contents($url);
$contents = utf8_encode($contents);
$obj = json_decode($contents);

$upgrade = $obj->offers[0];
$WPversion = $upgrade->version;
echo “WP Version: $WPversion<br />”;
?>

 

Also you will find the following link very useful for hiding various notifications in WordPress:

http://www.wpoptimus.com/626/7-ways-disable-update-wordpress-notifications/

Leave a Reply

Your email address will not be published. Required fields are marked *