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

后端 未结 1 525
北海茫月
北海茫月 2020-12-07 05:14

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 chang

相关标签:
1条回答
  • 2020-12-07 05:51

    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" />
    
    0 讨论(0)
提交回复
热议问题