Is it possible to change the path of a css file that is registered through wp_enqueue_style()?

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.

Read More

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.

Related posts

Leave a Reply

1 comment

  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.