Getting version number of latest WordPress release

WordPress.org offers an api that includes a version checker. That version checker can return a json response (or a serialized string if that’s your thing). Example usage $url=”https://api.wordpress.org/core/version-check/1.7/”; $response = wp_remote_get($url); $json = $response[‘body’]; $obj = json_decode($json); The resulting $obj will contain an offers array, whose first element is an object that contains the information … Read more

Disable WP core updates but send email notification

It looks like after switching code to check get_site_transient(‘update_core’) I have got what I need just action must be executed in a proper priority or a hook (thoughts/suggestions?). Working code below: function core_update_notification(){ global $wp_version; $installed_version = $wp_version; $uc_transient = get_site_transient(‘update_core’); if ( empty($uc_transient->updates) ) return; $updates = $uc_transient->updates; $current_version = $updates[0]->current; if (version_compare($installed_version, $current_version, … Read more

Supporting older WordPress versions in a Plugin/Theme? [closed]

Supporting old versions of WordPress seems reasonable, but is it really necessary? Personally, I think supporting old versions is waste of efforts and time and it prevents end-users from updating their WordPress installs. What’s the point of being a WordPress developer if you’re encouraging users to remain using insecure and out-of-date versions? Just adding a … Read more

How to remove the WordPress version from some .css/.js files

You can check for the current handle before removing the version. Here’s an example (untested): add_filter( ‘style_loader_src’, ‘sdt_remove_ver_css_js’, 9999, 2 ); add_filter( ‘script_loader_src’, ‘sdt_remove_ver_css_js’, 9999, 2 ); function sdt_remove_ver_css_js( $src, $handle ) { $handles_with_version = [ ‘style’ ]; // <– Adjust to your needs! if ( strpos( $src, ‘ver=” ) && ! in_array( $handle, $handles_with_version, … Read more

Where does WordPress store version number?

If you need to get the wordpress version in your script, there is a global variable: $wp_version (right now it’s something like ‘3.1-RC3-17376′) It contains the wordpress version. If you need to acquire if from a file, you can read it from /wp-includes/version.php: function getWPVersion() { $path=”/path/to/wp-install”; include $path.’/wp-includes/version.php’; return $wp_version; } WordPress Version Variables … Read more