Changing the ‘WordPress Address URL’ of your blog the hard way

Follow the steps shown here if you can no longer access the admin site of your wordpress blog.

If you have accidentaly (or stupidly 🙂 ) changed the WordPress Address of your blog to an incorrect value, you’ll find out that you can no longer access the admin console to change it back. To fix it you have two options:

  • Temporary PHP change
  • Direct database change

Temporary PHP change

For this option, you will temporarily hardcode the correct wordpress address in your template and then remove it after correcting the address in the admin page.

Step 1

Add the following near the top (i.e. in a new line after the first ‘<?php‘) of the functions.php file:

update_option('siteurl','http://example.com/wordpress');

Of course, you would replace http://example.com/wordpress with your actual wordpress url.

Step 2

Go to the admin URL of your blog, set the WordPress address (URL), and save the changes.

Step 3

Remove the code you added in Step 1.

Direct database change

Log in to your mysql database server. If you do not know the username and password, you can find them in the wp-config.php file in your wordpress installation.

Run the following SQL:

update wp_options set option_value='http://example.com/wordpress' where option_name='siteurl';

Again, you would replace http://example.com/wordpress with your actual wordpress url.

Author: Musaul Karim

Software Engineer, Hobbyist Photographer, and a bit of a gadget geek.

2 thoughts on “Changing the ‘WordPress Address URL’ of your blog the hard way”

  1. Life Saver! Thought I lost a blog after changing it in the admin settings. WordPress should really warn you when you’re making this change!

Leave a Reply

Your email address will not be published. Required fields are marked *