Update to older wordpress version from admin?

You can hook on option_update_core and edit the update url, as a plugin you can do something like this (Remember to disable the plugin after updating wordpress)

add_filter('option_update_core','wpse_26750');
add_filter('transient_update_core','wpse_26750');
function wpse_26750($options){
    global $wp_version;
    $updates=array(
        '2.5'=>'http://wordpress.org/wordpress-2.5.zip',
        '2.7.1'=>'http://wordpress.org/wordpress-2.7.1.zip',
        '2.8'=>'http://wordpress.org/wordpress-2.8.zip',
        '2.8.1'=>'http://wordpress.org/wordpress-2.8.1.zip',
        '2.8.3'=>'http://wordpress.org/wordpress-2.8.3.zip',
    );

    $currentUpdate=$options->updates[0];
    //Add Previous updates skipping the ones already passed
    foreach($updates as $version=>$updateUrl){
        if( version_compare($wp_version,$version) < 0){
            $update=new StdClass();
            $update->response="upgrade";
            $update->url="http://wordpress.org/download/";
            $update->package=$updateUrl;
            $update->current=$version;
            $update->locale=$options->updates[0]->locale;
            $options->updates[]=$update;
        }
    }
    unset($options->updates[0]);
    //Restore latest update
    $options->updates[]=$currentUpdate;
    return $options;
}

Starting 2.8 you also need to hook on transient_update_core as get_transient is used instead of get_option
Also, there is version checking here, so no versions lower than itself is shown.
The only (¿major?) issue, is that the list of versions need to added manually.

Leave a Comment