I'm working on a Wordpress site that needs a major overhaul... Made a separate domain for a testing environment. Changed all settings I can think of, edited the database when I exported, defined the new url and home in the wp-config file...
Yet somehow i'm getting linked to the old site. In other words, i'm on newsite.com but it's really pulling from oldsite.com.
So newsite.com/wp-admin is really oldsite.com/wp-admin ... Any changes I make are reflected on the old site, not the new.
I'm pretty stumped here.
Make sure that you define both WP_HOME and WP_SITEURL in wp-config.php:
define('WP_HOME','http://newsite.com');
define('WP_SITEURL','http://newsite.com');
Then add update the siteurl and home options by adding this to the functions.php file in your theme:
update_option('siteurl','http://newsite.com');
update_option('home','http://newsite.com');
You can set the WP_HOME and WP_SITE settings dynamically to match the current domain:
In your wp-config.php change the lines to read:
define('WP_HOME','http://' . $_SERVER['SERVER_NAME']);
define('WP_SITEURL','http://' . $_SERVER['SERVER_NAME']);