Guest User

Untitled

a guest
Feb 19th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. <?php
  2.  
  3. // If you're a host, and you have a plugin installed on every site,
  4. // either of the below hotfixes will allow WordPress 4.9.3 to update to 4.9.4.
  5.  
  6. // Option 1:
  7. // Fix the dependancies before the fatal is encountered:
  8. add_action( 'set_site_transient_update_core', function( $val ) {
  9. global $wp_version;
  10. if ( wp_doing_cron() && '4.9.3' == $wp_version && !empty( $val->updates ) ) {
  11. include ABSPATH . 'wp-admin/includes/admin.php';
  12. }
  13. } );
  14.  
  15. // Option 2:
  16. // Queue a "once-off" autoupdate cron task - as this calls wp_maybe_auto_update() direcly, it works as expected.
  17. // It'll get requeued as long as the install is on 4.9.3.
  18. // Calling `wp_maybe_auto_update()` directly is also enough.
  19. add_action( 'init', function() {
  20. global $wp_version;
  21. if ( $wp_version == '4.9.3' && ! wp_next_scheduled( 'wp_maybe_auto_update' ) ) {
  22. // Schedule it for in 12hr so that it only runs every 12hrs (and doens't overload this server with requests)
  23. wp_schedule_single_event( time() + 12 * HOUR_IN_SECONDS, 'wp_maybe_auto_update' );
  24. }
  25. } );
Add Comment
Please, Sign In to add comment