What priority should I give add_action('wp_enqueue_scripts', 'plugin_scripts');
?
Should my plugin scripts and styles load after the theme? Since I don’t know what the theme’s priority for scripts and styles is, should I arbitrarily select a large number?
In my testing, if I load a stylesheet in both a custom plugin and a custom theme, and don’t define a priority for either, the theme seems to take priority and enqueue after the plugin.
1 Answer
Default priorities are fine unless you have special cases where things need to load in a specific order, and even then, you should be defining dependencies for them instead of relying on priority numbers.
Priority numbers are a last resort mechanism, like CSS !important. Avoid setting them unless actually needed.