I need a stylesheet to be added to the header before anything else. That means before any styles or scripts that are automatically added by any of the plugins I’m also using.

I figured I could add this stylesheet with wp_enqueue_script, but I’m not sure how to force it to be loaded before other stylesheets or scripts that I do not have control over.

Thanks.

*This is for a theme which I need to add a stylesheet to. This is not for a plugin I’m building.

2 Answers
2

The tag that you want to call to execute your function is the wp_head() with a priority of 1.

In your child theme’s functions.php file, add the following:

add_action( 'wp_head', 'wpse_239006_style', 1 );
function wpse_239006_style() {
    wp_enqueue_script();
}

Leave a Reply

Your email address will not be published. Required fields are marked *