WordPress website still loading old style.css

后端 未结 6 976
心在旅途
心在旅途 2021-02-08 07:08

I have made changes to style.css but the wordpress website is still showing old contents. I checked the file in FTP, and the changes in the file are there, but it\'s not showing

6条回答
  •  Happy的楠姐
    2021-02-08 07:38

    This article has an interesting suggestion where you make your version equal to the current timestamp:

    wp_enqueue_style( 'louiscss', get_template_directory_uri() . '/mystyles.css', array(), time() );
    

    That function goes in functions.php and I believe you need to wrap that in a function and have add_action('init', 'your_wrapper_fn' ); later in functions.php (but I'm not entirely sure);

    You may want to put time() in while developing and then set it to a static version later.

    One thing that sometimes works is to "Settings > Permalink Settings" and literally just press the save button. I know it seems off the wall, but pressing that save button just seems to update the whole configuration.

    Having "Disable Cache" checked in the Chrome developer tools' "Network" tab is a good way to know if it's WordPress doing the caching. It's tough when you don't know if it's the brwoser or WordPress.

    Update: I'll leave this answer up, but I'm still having trouble.

提交回复
热议问题