Install old WordPress version

Hello,

I’m trying to install an old version of WordPress, the 4.8 to be clear, but I haven’t have luck so far. I ran into this WP Nostalgia repository, but I rather ask about it before moving forward with installing unknown script files. Is this the right solution for my problem or is there a better ‘more official’ solution I can use?

Thanks!

Hi Gio,

This may not be the best way to do it, but this is what I’d do:

  1. Create a new site in Local
  2. Go to Database » Adminer in Local and remove/drop all of the tables in the local database

  1. Browse to the site’s app/public folder and delete all of the files except for wp-config.php

  1. Download the desired release of WordPress here: Release Archive – WordPress.org
  2. Extract the downloaded WordPress archive into the site’s app/public folder along side the wp-config.php that you kept

  1. Navigate to the site in your browser and you should be prompted to go through the WordPress install process

  1. Go through the WordPress install process
  2. Done!
3 Likes

That is an interesting script if you frequently need to create a lot sites for testing (though I doubt it will work on Windows without a lot of GNU and some typical paths created).

@clay’s method is what I do and would recommend as well. It’s fairly easy and risk-free. The script that you linked seems like it would be more appropriate for some serious QA testing.

Thank you so much. This solution works for me.

I saw this answer on another post. To downgrade the wp version with wp cli.

wp core update --version=4.9.8 --force

Can use the Core Rollback plugin if you don’t have wp-cli access or not sure which version number to use.

I think there are probably limits to how far backwards you can force a downgrade. At least, after starting with a new Local site (with WordPress 5.7) I immediately tried to downgrade to WordPress 4.2 with wp core update --version=4.2.30 --force

The command succeeded, but accessing the site gives me a fatal PHP error. Seems to be caused by the default theme, which remains 2021. I’m sure I could work around this, but then I’d probably just run into other things that the downgrade process doesn’t handle correctly.

Safest method, at least if you want to cross major release boundaries, seems like the manual process described by @clay.

It seems that you would need to choose an older default theme, like TwentyTen or TwentyTwelve to ensure compatibility.

That would indeed solve the very first problem I ran into with downgrading so far back into the past.

My concern is that, if it’s not one thing, it’s another. What else does the CLI not take into account when downgrading? The theme issue surfaced immediately. Would the next thing be so obvious, or would I only find it after I’ve put other work into my task? How many things will I run into?

Migrating backwards, especially across major releases, is almost certainly a less tested path. And the manual installation process outlined by @clay takes only 2-3 minutes longer than using the CLI, while offering confidence that it’s done perfectly. So why not do it manually?

FWIW I use the Core Rollback plugin referenced above and the TwentyTwenty theme. I use this regularly for testing new core releases, betas, and RC releases.

I regularly test down to WP 4.0.33 this way.

It is effortless.

This is the process that I use, as well. But lately, there seems to be a problem that can be seriously annoying. The latest versions of WordPress want to automatically update core, by default. I don’t know how many times I’ve used @Clay’s method only to relaunch the website after the older version install and found the latest version has been reinstalled. It’s not enough to remove all traces of the current version (files and database). It’s also important to tell WordPress to NOT automatically update its core files.

Add the WP_AUTO_UPDATE_CORE define to your wp-config.php file before starting the downgrade, or at the end of the installation of the old version, WordPress will update it to the latest version.

Specifically, add the following line to wp-config.php.

define( 'WP_AUTO_UPDATE_CORE', false );

The feedback on this seems really good, but it didn’t work for me. I have a client who is currently running WP 5.3.8 on their site and i’m making some improvements for them. I’d like to create their exact environment by installing this older version of WP. I followed the instructions here (including the note from Paul to avoid the automatic update of the core) and when i try to open the site, i get a ‘403 Forbidden’ error.

The nginx error log shows the following:
[error] 15403#0: *1 directory index of “/Users/Me/Local Sites/xxx538/app/public/” is forbidden, client: 127.0.0.1, server: , request: “GET / HTTP/1.0”, host: “xxx538.local”

Everything that i’ve read tells me that this is a file permissions error. I have changed the file permissions on the folder listed above to “The world can read/write”, saved that, bounced the application and still the same error.

Can anyone offer any advice?
thank you!

I used WPDowngrade plugin (WP Downgrade | Specific Core Version – Plugin WordPress | WordPress.org Italia) from the dashboard of a running newer WP version

I need to launch a WP 4.9.22 site.
I used this solution and PHP shown a fatal error about the wp_options table not existing…

So i tried the same process but without leaving the app/public/wp-config.php there, instead i moved it to desktop so be able to read its content later on.
Then navigating to ....local/wp-admin should ask you to setup wp and inject database connection params, use values stored in desktop/wp-config.php.

If this doesn’t work try also with PHP 5 and MySQL 5, instead of PHP 8 and MySQL 8 ,while creating the Local site.
I done multiple trial and error so i don’t remember exactly order of things.

Hi @tresorama

What is your OS version and Local version?

Can you share your Local Log? Retrieving Local’s Log File

I forgot to say clearly that i succeded. :grinning:

My OS: MacOS BigSur 11.7.3
Local: 6.6.1+6281

My final working solution has this environment:

  • PHP: 5.6.39
  • Server: Apache 2.4.43
  • MySQL: 5.7.28
1 Like

Glad to hear it! Thanks for providing an update :slight_smile:

1 Like

This worked, thanks clay!