Last active
February 6, 2018 17:14
-
-
Save dd32/d015472a3cee169aa77593f8d119ee2a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// If you're a host, and you have a plugin installed on every site, | |
// either of the below hotfixes will allow WordPress 4.9.3 to update to 4.9.4. | |
// Option 1: | |
// Fix the dependancies before the fatal is encountered: | |
add_action( 'set_site_transient_update_core', function( $val ) { | |
global $wp_version; | |
if ( wp_doing_cron() && '4.9.3' == $wp_version && !empty( $val->updates ) ) { | |
include ABSPATH . 'wp-admin/includes/admin.php'; | |
} | |
} ); | |
// Option 2: | |
// Queue a "once-off" autoupdate cron task - as this calls wp_maybe_auto_update() direcly, it works as expected. | |
// It'll get requeued as long as the install is on 4.9.3. | |
// Calling `wp_maybe_auto_update()` directly is also enough. | |
add_action( 'init', function() { | |
global $wp_version; | |
if ( $wp_version == '4.9.3' && ! wp_next_scheduled( 'wp_maybe_auto_update' ) ) { | |
// Schedule it for in 12hr so that it only runs every 12hrs (and doens't overload this server with requests) | |
wp_schedule_single_event( time() + 12 * HOUR_IN_SECONDS, 'wp_maybe_auto_update' ); | |
} | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment