Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a Wordpress 2.7.x setup that I would like to migrate to the latest version 3.2.1, however I need to make a stepped-upgrade as some plugins need an older version first (3.0.6 IIRC).

However Wordpress is only offering me the latest and greatest version to upgrade to. Is there a way - prefereably within the admin - to update core to a specific version? Or am I bound to manual upgrades?

Is there probably a way to tell the wordpress core upgrader which version to pick? It was downloading a zip only recently, right?

share|improve this question
add comment

2 Answers

up vote 4 down vote accepted

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.

share|improve this answer
    
That's interesting. Do you know if there is a hook to offer multiple versions in the backend as a list? –  hakre Sep 25 '11 at 8:37
    
Not that im aware of, im updating my answer to match multiple version (still using the same hook) –  Hansy Schmitt Sep 25 '11 at 23:23
    
That looks very sweet. Thanks a lot Hansy, I'll consider this for some little plugin. –  hakre Sep 26 '11 at 10:00
add comment

I'm not sure of a way to do it through admin but it would be easy to accomplish with svn.

Make a copy or move wp-content and wp-config.php to a temp directory then delete all the WordPress files and check out the 2.8 branch, move wp-content and config back, then run the update script.

mv wordpress/wp-content /tmp/wp-content
mv wordpress/wp-config.php /tmp/wp-config.php
rm -rf wordpress
mkdir wordpress
cd wordpress
svn co http://core.svn.wordpress.org/tags/2.7.x/ .
mv /tmp/wp-content/* wordpress/wp-content/
mv /tmp/wp-config.php wordpress/wp-config.php

//Run upgrade script:  http://yoursite/wordpress/wp-admin/upgrade.php

//Check out the next version
cd wordpress
svn sw http://core.svn.wordpress.org/tags/2.8.x .

//Run upgrade script

//Rinse and repeat
share|improve this answer
    
Well why I was asking for admin was because it's just a standard hosting webserver, they normally do not have svn available. What I alternatively do is just upload the versions zipfile and extract it over (older versions are available as packages from the wordpress website). I didn't run into problems, config does not get overwritten, only akismet, hello dolly and the default theme. –  hakre Aug 25 '11 at 7:22
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.