For example if you’re developing a new WordPress site behind the scenes of your live site you may need to change the siteURL to an IP address.
Here are four ways you can change your site URL.
Option 1 – WordPress Dashboard – Click Settings > General screen in a single site installation of WordPress, there are two fields named “WordPress Address (URL)” and “Site Address (URL)”. They are important settings, since they control where WordPress thinks your site is located. They control the display of the URL in the admin section of your page, as well as the front end, and are used throughout the WordPress code.
The “Site Address (URL)” setting is the address you want people to type in their browser to reach your WordPress blog.
The “WordPress Address (URL)” setting is the address where your WordPress core files reside.
Option 2 – using phpmyadmin – Within your Customer Control Panel > Click the More Services Tab > Click Databases > Click the database that is associated with your WordPress site. Click the link to Browse database manager. Click on the + to see all the tables, click the wp_options table.
In the middle of screen you’ll see the table rows. Find and click the edit link for the siteurl table. Enter the desired URL and click Go to save changes.
Option 3 – 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 “example.com” is the correct location of your site.
define(‘WP_HOME’,’http://example.com’);
define(‘WP_SITEURL’,’http://example.com’);
This is not necessarily the best fix, it’s just hard coding the values into the site itself.
You won’t be able to edit them on the General settings page anymore when using this method.
Option 4 – Edit functions.php – If you have access to the site via FTP, then this method will help you quickly get a site back up and running, if you changed those values incorrectly.
- FTP to the site, and get a copy of the active theme’s functions.php file. You’re going to edit it in a simple text editor and upload it back to the site.
- Add these two lines to the file, immediately after the initial “<?php” line.
update_option(‘siteurl’,’http://example.com’);
update_option(‘home’,’http://example.com’);
Use your own URL instead of example.com, obviously.
Important! Do not leave those lines in the functions.php file.
Remove them after the site is up and running again.