How to change the WordPress Site Url

     
12th December, 2013 by

When you first install WordPress you usually don’t want to set the Site URL to the full public domain until development is complete. When this is the case you would set the site URL for wordpress to be a test domain or perhaps just the ip address of your server.

When it comes time to go live in production you need to switch the base domain. Unfortunately WordPress doesn’t give you a configuration screen to do this.

The Site URL and Site Home Page setting are both stored in the database and need to be updated for WordPress to operate correctly. Thankfully there is an easier way than updating the database correctly.

Simply navigate to your theme directory and add these lines to the functions.php file of your theme:


update_option('siteurl','http://www.updated-url.com');
update_option('home','http://www.updated-url.com');

Then open a new browser window and navigate to the existing domain/ip address for your site.

Now you can navigate back to your theme directory and remove those two lines and your done

Delivery Manager

Daniel has been an evangelist for internet applications and infrastructure for over 15 years. A graduate of the university of Wollongong Computer Science department, he has delivered projects in complex applications ranging from Flight Center's corporate bookings engine to Macquarie Bank's equities trading platform.

When not at ServerMule Daniel can be found with his surfboard under his arm heading to the beach for a surf or encouraging his young son and daughter to get out there amongst the waves.

Read More from