Change The Site URL in WordPress

Sometimes you may need to change the URL of your WordPress site. For example, it is a common practice to develop the new version of your site in a sub folder (like example: ) and When it is ready to move it into your root folder (

There are two easy methods to change the Site URL manually.

Method 1: Edit wp-config.php

It is possible to set the site URL manually in the wp-config.php file.  Add these two lines to your wp-config.php, where “” is the correct URL of your site.

Method 2: Edit functions.php

Simply add these below two code lines to the functions.php file of your theme.

update_option( 'siteurl', '' );
update_option( 'home', '' );

Use your own URL instead of

Then simply load your site from its new location ( – it should work just fine. Note that after you run your site once and you make sure it works you should remove those lines from your functions.php file.

Leave A Reply

Your email address will not be published.