Home > Back-end >  style in css is not updating in wodpress
style in css is not updating in wodpress

Time:06-16

i have this code to import the css it's working fine but not updating my css latest update right now

// style imports
function themeslug_enqueue_style() {
    wp_enqueue_style( 'bootstrap', plugins_url('/bootstrap/css/bootstrap.css', __FILE__), false );
    wp_enqueue_style( 'my-style', plugins_url('/assets/mystyle.css', __FILE__), false );
}
add_action( 'wp_enqueue_scripts', 'themeslug_enqueue_style' );
add_action('showForm', 'showInterface');

this is my plugin directory

turnvoer-calculator
    assets
       mystyle.css
    turnover-calculator.php

CodePudding user response:

If your stylesheet (mystyle.css) success enqueue but it's not update your latest changes - most of the case is because of cache issue (usually have at least 2 layers of cache in a WP site).

So you need to force your WP site to load the newest version of your stylesheet by adding time argument to your stylesheet's url. Your case, using this code:

wp_enqueue_style( 'my-style', plugins_url('/assets/mystyle.css?time=', __FILE__).time(), [], false );

Please replace it with your code and try again.

  • Related