Force WordPress Auto-Update

I was excited to try out the new auto-update feature in WordPress 3.7.1. But the first attempt failed, since I had an old .svn directory sitting around. Deleted that, then waited… days. Communicated with one of the core devs on Twitter, who said that this first rollout was intentionally slow, to get things up to speed.

Finally got tired of waiting and decided to take matters into my own hands. Didn’t want to click the Update button – that would be cheating. Discovered there’s a new function call: wp_maybe_auto_update() that triggers the process that’s supposed to run via wp-cron.

So to trigger it from the command line, all you have to do is to create a small script in your WP root directory that bootstraps WP core and calls the function:

<?php
  // request-update.php
  require( dirname(__FILE__) . '/wp-load.php' );
  wp_maybe_auto_update();
?>

With that in place, run:

php ./request-update.php

Wait a few seconds, and your site should be updated. Check the Updates page in your Dashboard and confirm that you received the update email, and Bob’s your uncle.

One thought on “Force WordPress Auto-Update

  1. Instead of deleting your svn directory, you can throw this in your force update script:

    add_filter( ‘automatic_updates_is_vcs_checkout’, function( $checkout, $context ) {return false;}, 10, 2 );

    WordPress won’t run automatic updates if you are working in a version-controlled directory. This filter will disable that and allow an update.

Leave a Reply

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