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 10
.
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
FEW NOTES
-
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.