If you are searching the internet for fixing the “upgrade.php?_wp_http_referer=%2Fwp-admin%2F” error, you are at the right place.
So I tried to upgrade my website WordPress version to 6 and soon after the upgrade I was presented with a 404 error and the URL was something like “https://www.example.com/wp-admin/upgrade.php?_wp_http_referer=%2Fwp-admin%2F“.
The interesting part was that I was able to access my website from the frontend, but I was not able to login to the backend after the WordPress upgrade.
Also, the above URL is not fixed if you are trying to access a different location of your WordPress admin dashboard, such as plugins, posts, pages, etc.
This error message typically appears when there is a problem with the WordPress upgrade process, and it is unable to redirect to the proper page after the upgrade is complete.
This can generally occur after each core WordPress upgrade, so you should know how to fix this which we are going to discuss in this article.
Steps to Solve upgrade.php?_wp_http_referer=%2Fwp-admin%2F
1. The first thing you should try is to not PANIC. I know production WordPress websites are very important, so it is always best to create a manual backup or use a WordPress plugin like WP Time Capsule to backup your website.
2. Now go to your web hosting dashboard and search for phpMyAdmin. Here we have to go to the website database.
If you have multiple databases and don’t know the name of the database of the affected website, then just go to the file manager and the website folder, and look for “wp-config.php“.
This file has the database name which your WordPress website is using.
3. Now once you are in phpMyAdmin and in the correct database, just look for the “options” table. It will be wp_options if you have not changed the table name.
4. Now in this table look for “db_version“. If you are not able to find it, just increase the no. of rows or check the second page. This version should basically match the version of DB which is present in the file “wp-includes/version.php”
5. Correct, now you have to go to “wp-includes/version.php” and check the version of db. It should look something like the below screenshot.
6. As you can see from the above 2 screenshots, the WordPress database version does not match. So now just simplyput the version present in version.php in “db_version” in the database.
That’s all! Just reload the website or the page you are trying to access and this should resolve the issue.
In this post, I have not discussed the obvious method of renaming the plugin directory. 🙂
It’s always recommended to backup your website before making any changes. You can also schedule cron jobs to manually take backup of your files.
Please note that if you are using managed WordPress hosting you might not have access to the version.php file and in that case, you should contact the hosting provider support to help you with that.
If this article helped you, please leave a comment and let me know. Also, you can subscribe to a free newsletter for more posts in the future.