WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm having a little problem with a wordpress installation. Basically, I have two servers: test.dev and staging.dev.

Set up (using the hosts file) and I've just copied the test.dev WordPress installation over to the staging server. Works brilliant on my computer but on someone who doesn't have test.dev none of the CSS or images load. I looked into it and every path is still referencing test.dev. I have this function in functions.php:

function route_static_path($path)
    echo get_template_directory_uri()."/".$path;
    return true;

I thought the value for get_template_directory_uri() might be set in wp-config.php but it's not. I'm really confused as to where this is coming from.

share|improve this question

Caching is not your problem here. The home URL and site URL are stored in the wp_options table in your database. You can update them either by visiting the Settings > General page in your WordPress dashboard, or you can edit the siteurl and home option values directly in the database through an SQL query or a client such as phpMyAdmin.

You can also override any site or home URL option stored in the database by adding the following code to your wp-config.php file:

 define( 'WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] );
 define( 'WP_HOME',    'http://' . $_SERVER['HTTP_HOST'] );

The above code will adjust depending on your domain.

share|improve this answer

It would appear this setting is for some reason stored in the database. I just ran this query:

UPDATE `wp_options`
SET `option_value`='http://staging.dev'
WHERE `option_name`='siteurl'
share|improve this answer

I think this is a site migration problem. You need to everything that refers to test.dev to now be staging.dev in the database. You can use this script to help you with this task: http://interconnectit.com/products/search-and-replace-for-wordpress-databases/

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.