0

I have made a plugin for my website which has custom CSS Styles. I don't know why, the styles, once the plugin is activated, they look normal, as expected. But when I update the plugin's .css file, it always looks like as the 1st version of the .css file. I tried to clear cache with WP Rocket and on Chrome, and it doesn't work. But when I go with Incognito Mode, it charges the most recent version of the .css file.

How can I change that?

For example, for a custom template for my theme, I do something like:

<?php 
function picaronia_dashboard_remove_all_styles() { 
 if (is_page_template('dashboard.php')) { 
  global $wp_styles; 
  foreach ($wp_styles->registered as $item) { 
   wp_dequeue_style($item->handle);
  } 
 } 
} 
add_action('wp_print_styles', 'picaronia_dashboard_remove_all_styles');

function write_picaronia_dashboard_styles() { 
 if (is_page_template('dashboard.php')) { 
  $src = get_site_url() . "/wp-content/plugins/dashboard-de-   picaronia/css/frontend.css"; 
  wp_enqueue_style('picaronia-dashboard-styles', $src);
  wp_enqueue_style('google-fonts-picaronia-dashboard', 'https://fonts.googleapis.com/css?family=Roboto');
 }
} 
add_action('wp_print_styles', 'write_picaronia_dashboard_styles'); 
?>

It seems like the plugin's CSS styles file remain in caché and it doesn't update.

Thanks.

0

It's only a cache issue, you need to clean your browser and/or server cache.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.