3 thoughts on “Using WP_DEBUG to Improve CSS and Style Enqueues in WordPress Leave a comment

  1. Maybe another approach on this:

    $the_css_file = get_stylesheet_directory() . '/css/style.css';
    wp_enqueue_style( 'css-file-handle', $the_css_file, NULL, filemtime($the_css_file) );

    From the PHP manuals: filemtime returns the time the file was last modified, or FALSE on failure. The time is returned as a Unix timestamp.

    Greetings from Germany

    1. Hey Andre – that’s a good way too but it’s not something I like to do in production since it needs an additional file operation which can be slow. Of course if you have a small ish site it’s not going to be an issue, but every little helps 🙂

  2. Hey! Great post. I will be implementing this on my own site. CSS is super confusing but you definitely nailed it.

Leave a Reply

Your email address will not be published.