Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
363 views
in Technique[技术] by (71.8m points)

css - Why do changes to some php files take so long to show on the live site

I'm using WordPress. Sometimes when I update certain php files in the theme the changes show on the live site right away (header.php for example). However when I make changes to php files in the CSS folder (skin.php) for example, it can take several hours for these changes to be reflected in the live site. Any idea why this takes so long and if there's any was to force it to update. Sounds like a cache issue, but I've cleared my local cache and tried other browsers that have never been to this site and the changes do not show. So maybe some type of cache on the server? I'm not using any cache plugins.

Example site if this helps. http://freemanep.com/

Thanks.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I use Mark Jaquith's solution (see here) to stop my stylesheets being cached. Not sure it applies in your case, given it happens on a new browser, but it's worth a try.

In essence you append the file modification timestamp to the URL, so when the file changes, the browser thinks the URL has changed and downloads the latest version. Mark's example, for the theme stylesheet:

<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); echo '?' . filemtime( get_stylesheet_directory() . '/style.css'); ?>" type="text/css" media="screen, projection" />

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...