The theme I am using already calls the wp_enqueue_style function to enqueue a css file.

I want to whether it is possible to change the css file path before it is actually outputted on the page.

Why I want to do this?

Basically, I want to check if it is a dev or prod environment. Based on that I want to include either the uncompressed or compressed file.

1 Answer 1


I wonder if you are looking for the style_loader_src filter?

For example:

add_filter( 'style_loader_src', 
    function ( $src ){

        // ... your stuff ... 

        return $src;

Similarly there exists the script_loader_src filter.

There's also the base_url property of the global $wp_scripts and $wp_styles objects, but I think that's only used for enqueued native styles and scripts.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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