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

WordPress install enters an infinite loop

I finally found a solution to this problem and thought I would post my solution for anyone looking for assistance. My main website sits on /public_html on my server I was installing new sites on a subdomain (e.g. newwebsite.com.au) in a sub-directory: /public_html/sites/newwebsite.com.au Even though /public_html/sites/newwebsite.com.au was the root directory for the subdomain: newwebsite.com.au for … 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

Does the event ‘wp_version_check’ even exist? What is it doing?

The function checks your version of WP for possible updates. It appears that there is a transient in the database named ‘update_core’, so it’s stored in the $wpdb->options table as ‘_site_transient_update_core’. The value of that transient is a serialized object that has information, I’m not an expert on wp_version_check, but it uses that transient to … 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

What is the importance of writing a < WP 3.x compatible plugin nowadays?

Always write plugins for the current version and keep the nightly builds from the upcoming versions in mind. Anything else doesn’t matter. Edit As @toscho pointed out in a comment: There might be some explanation needed to why it is that way. Because I say so. Plugins only need to be compliant with core because … 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