Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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
add comment

3 Answers

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
add comment

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
add comment

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
add comment

Your Answer

 
discard

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.