wp_enqueue_style()'s doc I see the third parameter is for stylesheets to be loaded before the one called by the function.
But is it possible to do the contrary, meaning to instruct WP to load a stylesheet before the theme's stylesheet?
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.Sign up to join this community
By default, themes usually almost always enqueue scripts and style via the
wp_enqueue_scripts hook with default priority set in add action. This is the
add_action() statement by default
add_action( 'wp_enqueue_scripts', 'my_custom_styles_and_scripts' );
As you can see, a priority is not set in the action, which means that it will default to
With this in mind, you can use a priority of less than
10 to load your styles and scripts earlier than the theme, keeping in mind, the
$deps parameters should not be set when you enqueue and/or register your styles and scripts
If no priority is set in either plugin or themes, and a styles or scripts is loaded from a child theme or plugin, the plugin style/script will load first, then those in the child theme and then the main (parent) theme's styles and scripts. This is the order in which functions load by default
Within the same function, styles and scripts are loaded in the order they appear inside the function, so the style/script appearing first will load first. Again being said, that is if the
$deps parameters aren't set.