Good day!

There is a site on Wordpress 4.2.2. The site is cloned to a local server. As a result of the change of the main style file, changes on the site are not displayed. I noticed that the link tag has a version parameter ?ver=4.2.2 . Disconnected it using the found solution:

  // remove wp version param from any enqueued scripts function vc_remove_wp_ver_css_js( $src ) { if ( strpos( $src, 'ver=' ) ) $src = remove_query_arg( 'ver', $src ); return $src; } add_filter( 'style_loader_src', 'vc_remove_wp_ver_css_js', 9999 ); add_filter( 'script_loader_src', 'vc_remove_wp_ver_css_js', 9999 ); 

But it did not help. Styles are still cached. There is no explicitly specified link tag in the header.php template.

  <? wp_head() ?> <link rel="shortcut icon" href="<?php echo get_stylesheet_directory_uri().'/favicon.ico' ?>" /> <script type="text/javascript"> ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>'; templateuri = '<?php echo get_template_directory_uri()?>'; </script> <?php global $title ?> 

Therefore, to add ?1 to the desired style, as indicated in one of the solutions on stackoverflow is impossible.

Third-party page caching plugins are not used.

Please tell me if there are other solutions to this issue?

  • one
    Most likely, the browser caches styles as directed by the server. Check the headers sent and received by the browser when opening the css file. - Fomina Catherine
  • Dmitry, thanks for the prompt reply. Tell me, please, how to do this? - kover-samolet
  • In htaccess there are no instructions about caching. - kover-samolet
  • htaccess only changes the default server settings. Call the browser console and go to the Network tab or similar, depending on the browser used. After you switch to it, reload the page. In the list of files that appear, select the one you need and click on it to see detailed information. Most likely you will find the Cache-Control header: - Fomina Ekaterina
  • Dmitry, I met such a headline, but it has a different meaning, like this: Cache-Control: max-age = 0 - kover-samolet

2 answers 2

Add to the .htaccess file

 <FilesMatch ".(css)$"> Header append Cache-Control "no-store, no-cache, must-revalidate" </FilesMatch> 

And refresh the page with ctrl + R

  • Unfortunately it did not help. The result is the same, the headers have not changed. - kover-samolet
  • And in the headers of this css file in the browser appeared the values ​​that we have now added? "no-store, no-cache, must-revalidate" - Fomina Ekaterina
  • The first time I watched - did not pay attention. Yes, they did, but the styles are still not updated. Screenshot link: dropbox.com/s/e9hce7jplspzlag/headers.png?dl=0 - kover-samolet
  • It all worked! Thank you so much for your help! - kover-samolet

Partially solved the problem, I turn on the incognito mode on the browser, the cache is not stored there, at the development stage, it is quite convenient.

  • Please give a more detailed answer. - 0xdb