get_template_directory_uri cached?

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:

Read More
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.

Related posts

Leave a Reply

4 comments

  1. 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.

  2. 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'
    
  3. Just stumbled upon the same issue. Although I replaced the URL in all .php files and in the table options (siteurl and home), Chrome console still said that I try to load theme resources from another domain. I checked my database and found a cache option. I deleted it from my database. WordPress then creates a new entry using the updated siteurl from database.

    DELETE FROM options WHERE option_name = 'us_theme_options_css';