While you can practically control order of hooked things by priority, it’s not always the right tool for the job.
In case of styles you should be using appropriate wp_enqueue_style()
function which allows you to easily set up elaborate dependencies which will be automagically processed by WP to produce desired order of styles output.
Unfortunately while there is analogous wp_enqueue_scripts()
for scripts, you cannot cross-depend scripts and styles like your question indicates. However it is common practice to not start JS execution until page has fully downloaded, so in most cases explicit depending on CSS should not be necessary.
Related Posts:
- Wp_head and wp_footer vs wp_enqueue_script javascript files?
- How can I remove the site URL from enqueued scripts and styles?
- How do I force wp_enqueue_scripts to load at the END of ?
- Removing specific style from wp_head
- Track down where script is being enqueued from
- How to use wp_enqueue_style() and wp_enqueue_script() only when needed?
- Remove specific CSS and JS from the head
- Getting wp_footer() to work without wp_head()
- Custom script file enqueue has “?ver=4.5.1” when loading and doesn’t update
- All of my Scripts and Enques are getting file not found
- How can I remove the site URL from enqueued scripts and styles?
- Most optimal way of starting fresh, without using other theme or dropping old files?
- wp enqueue style on specific page templates
- How do I get the $handle for all enqueued scripts?
- How can I get a list of all enqueued scripts and styles?
- Load CSS/Javascript in frontend conditionally if block is used
- Register a script to be enqueued both in admin and front end
- Cannot deregister a script using wp_deregister_script
- Conditional wp_enqueue_script on a page
- Enqueue custom font file with rel=”preload”
- Why is jquery-ui-core enqueueing in my footer instead of the header?
- Get the list of enqueued/registered scripts for a specific post?
- Add script to footer – on post editor
- Which action to hook wp_enqueue_script to? wp_head or wp_enqueue_scripts? [duplicate]
- enqueue and localize script in footer
- What determines the order of enqueued styles?
- Enqueue script only if page has an oembed
- It would be a right way to enqueue the script using foreach loop?
- Is this a bad implementation of wp_enqueue_script for conditional usage?
- Don’t load scripts if on mobile/tablet
- How to Add a Custom Script to Customize.php
- Remove a script from a template file using wp_dequeue_script
- Child Theme – what is the scope of overwriting files?
- Enqueue scripts to footer
- Add last modified time as version to css and js
- Enqueue script on specific WooCommerce template
- Indenting (tabbing) WP_head
- Custom Plugin Development: What priority should wp_enqueue_scripts have?
- Select2 in WordPress
- How to switch css files according to devices and button click?
- How to control the order of the combination of enqueued styles and scripts – site speed issue
- Register script/style: Is it possible to customize the version query string via plugin?
- scripts not enqueueing
- Asset loading with gulp.js or Grunt
- Enqueue AWS Script
- How can I make sure my JS script gets executed first, among other scripts?
- How to load script-related styles automatically?
- Optimizing WordPress’s styles and scripts
- How do I enqueue a js file in functions.php for a if lt IE 9 statement? [duplicate]
- How to enqueue a style using wp_enqueue_scripts()?
- Retrieve URL of Script/Style and Dependencies
- wp_enqueue_script called incorrectly
- How to change script order?
- Enqueue script multiple times?
- Including files in Child Themes
- Can’t load JS File
- Exclude external uri for css and js version
- Do I need to register my own created .js and .css files
- How to add parameter to wp_enqueue_script?
- Change script type and src of plugins in theme
- How to enqueue the script without hardcoded in the theme files?
- get_template_directory_uri() gives me wrong path when I try to use wp_enqueue_style
- Overwrite wp_enqueue_script under certain condition
- Enqueuing script is adding extra text for google maps [closed]
- get_stylesheet_directory() in child theme breaks parent scripts
- Enqueueing Scripts and Styles
- Not all my scripts are enqueueing
- JavaScript is not enqueuing
- Enqueue scripts based on options
- How to use wp_enqueue_script, style when required
- Why does WP load so many files in the head of source code? How do I optimize it?
- Enqueue Script in WordPress
- how to enqueu customiser/customizer scripts?
- how to enqueue javascript to manipulate acf input field in admin?
- Plugin add_action and add_menu_page
- load a different stylesheet in a category post
- How to register script with null value for version?
- Where are the contents of WP_Head
- How to use only scripts from new theme?
- is there a way to get all queued scripts/styles into a template without `get_header()`?
- thickbox never gets called (weird behavior)
- We are facing this error in header unable to understand the issue
- How to do chunked JS files in WordPress?
- Copy permalink to clipboard automatically when publish/update posts?
- WordPress wp_enqueue_style and wp_enqueue_script not working
- Stylesheets and scripts not loading
- Scripts and stylesheets failing to load in Chrome IOS (and only Chrome IOS)
- i can’t handle any style or Js file on my theme . what is the problem of this file?
- ajax jquery live search box not working in wordpress plugin
- Dealing with multiple Google maps API calls
- Prevent caching when using wp_enqueue_script?
- Should I be enqueueing styles/scripts once and then dequeueing them?
- Initializing scripts in wordpress
- wp_enqueue_script was called incorrectly… i want to work with debug on
- Loop through arguments of a function
- wp_enqueue_scripts hangs
- Echo a div to header.php from functions.php
- Using wp_enqueue_script in a wordpress plugin
- How to enqueue js script after another specific js script?
- Should I use wp_register_style(), wp_enqueue_style, or both?