Call 02380 004 154

Email [email protected]

How to update your WordPress URL from PHPMyAdmin

Posted on 16 February 2022

Sometimes we’ll run into a site that has had it’s domain updated but before the previous domain expired the website wasn’t updated to the new domain. We’ve also run into websites that have been partially migrated from a staging setup to production where a backup has been used instead of transfer. This has meant the domain has stayed the same and the site can no longer be accessed.

The best way to update your domain is through wp-admin if you can. If you’ve tried everything you can with regards to getting into wp-admin with no joy – there is another way.

The Solution

The only working solution to the following so far that we have found is to update the URL from within PHPMyAdmin. There are a number of fields where this URL needs to be updated. Fortunately. With the folllowing piece of code you can update the URL.


Getting to PHPMyAdmin

To enter the code you need to get to PHPMyAdmin. There may be specific steps to do this depending on your web host but if you’re using cPanel then it should be as follows.

  • Sign into your web host account
  • Go to cPanel
  • Scroll down and open the PHPMyAdmin link (under databases)
  • Select the WordPress database
  • Enter the following code
UPDATE wp_options SET option_value = replace(option_value, '', '') WHERE option_name = 'home' OR option_name = 'siteurl';UPDATE wp_posts SET guid = replace(guid, '','');UPDATE wp_posts SET post_content = replace(post_content, '', '');

UPDATE wp_postmeta SET meta_value = replace(meta_value,'','');

With the above you’ll need to update to the url the site was using. You will then need to update to the url you want the site to be using. You don’t need to include http:// or https:// but you should make sure you’re using www. or not at the start of your domain. Good luck!

The above code will also work via software like toad if you can’t access PHPMyAdmin but you’ve got access to your MySQL database with that.

The above code comes with no warranty.

Share this post with your friends, followers and connections!

Subscribe to our mailing list

* indicates required

View previous campaigns.