I am making a test plugin that contains a test.css and a test.php file.

Here is the test.php file:

Plugin Name: Site Plugin for Quảcầu.com
Description: Site specific code changes for Quảcầu.com

function add_theme_scripts() {
  wp_enqueue_style( 'style', get_stylesheet_uri() );
  wp_enqueue_style( 'slider', plugins_url( 'test.css', __FILE__ ), array(), '1.1', 'all');   
add_action( 'wp_enqueue_scripts', 'add_theme_scripts' );

Here is the test.css:

body {
    background-color: red !important;

This works fine. However, when I change the color to green, or delete the test.css altogether, the color still remains red. The only way to revert the color back to the default is to comment out the add_action line. This indicates that this is not a caching issue or the color red is set somewhere else. Do you know why?

  • 2
    Commenting out add_action does not eliminate caching as a cause, it only eliminates fullpage caching plugis. Browsers cache CSS files, and plugins could be optimising the stylesheet into a separate file. Are you sure you eliminated caching as a potential cause? AKA load the file directly using a new browser or a tool that does not cache? WordPress core does not cache files, the only thing that would cause this in vanilla WP is if you had kept the version string identical and the browser cached it because the URL was identical – Tom J Nowell Mar 8 at 17:15

Your Answer

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

Browse other questions tagged or ask your own question.