Title: Feature Request: wp_enqueue_style with priority/load order
Last modified: August 21, 2016

---

# Feature Request: wp_enqueue_style with priority/load order

 *  [Angelina Belle](https://wordpress.org/support/users/angelina-belle/)
 * (@angelina-belle)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/feature-request-wp_enqueue_style-with-priorityload-order/)
 * Requested: A way to control the order style sheets are loaded.
    Implementation:
   Something like the do_action priority numbers — smaller numbers are loaded earlier,
   higher numbers loaded later.
 * Justification: Plugin stylesheets are enqueued AFTER theme stylesheets.
    The 
   result is that some features (color, background-color, etc) might look awful 
   with some themes. The theme-related “adjustment CSS” for this needs to be loaded
   AFTER the plugin CSS, but should be stored with the child theme CSS files for
   sanity/maintainability — different “adjustment CSS” would be required if the 
   site switches themes, so modifying the plugin or creating a separate “adjust 
   Events for theme-of-the-year” plugin seems less easy to maintain.
 * Implementing style enqueuing order would allow loading “adjustment CSS” AFTER
   plugin CSS is loaded.
 * Workaround: themes/childtheme/Adjustment.CSS can be read into a string and enqueued
   as inline CSS.
 * Thanks for considering this feature request.

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Moderator [Jan Dembowski](https://wordpress.org/support/users/jdembowski/)
 * (@jdembowski)
 * Forum Moderator and Brute Squad
 * [12 years, 2 months ago](https://wordpress.org/support/topic/feature-request-wp_enqueue_style-with-priorityload-order/#post-4749140)
 * I’m pretty sure that it doesn’t need a priority because that’s called via an `
   add_action()` call and that does have a priority argument.
 * [https://codex.wordpress.org/Function_Reference/wp_enqueue_style](https://codex.wordpress.org/Function_Reference/wp_enqueue_style)
 * Code example.
 * [https://codex.wordpress.org/Function_Reference/wp_enqueue_style#Using_a_Hook](https://codex.wordpress.org/Function_Reference/wp_enqueue_style#Using_a_Hook)
 * So if you needed that loaded later try
 *     ```
       add_action( 'wp_enqueue_scripts', 'theme_name_scripts', 15 );
       ```
   
 * With 15 being loaded after the default priority of 10.
 * You can find some really good examples at this site.
 * [http://themeshaper.com/modify-wordpress-themes/](http://themeshaper.com/modify-wordpress-themes/)
 *  Thread Starter [Angelina Belle](https://wordpress.org/support/users/angelina-belle/)
 * (@angelina-belle)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/feature-request-wp_enqueue_style-with-priorityload-order/#post-4749280)
 * I think that exposing a load order/priority in wp_enqueue_styles will make it
   easier for everyone to comply with the team’s recommendation to use this function
   for adding stylesheet links to the HTML head.
 * Thanks for your workaround suggestion. I had not thought of that because I have
   not yet read enough code to learn I could do it that way. Instead, I called wp_enqueue_style
   from the last hook I could find before the style links are emitted. It is very
   kludgy, but it does use the recommended function call.
 *     ```
       add_action('wp_head','AB_late_css',1);
       function AB_late_css(){
       	$source = get_stylesheet_directory_uri().'/adjust_ABplugins.css';
       	wp_enqueue_style('adjust_ABplugins', $source);
       }
       ```
   
 *  [ovrzls](https://wordpress.org/support/users/ovrzls/)
 * (@ovrzls)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/feature-request-wp_enqueue_style-with-priorityload-order/#post-4749373)
 * Thanks for this post it was very helpful. I needed my parent theme style to be
   loaded between the enqueued boostrap style and the child theme style. The Parent
   theme overrides some bootstrap styles and the child overrides some parent style.
   Believing that enqueued style is the best practices, I registered the bootstrap
   style in the parent theme. Then the child theme uses the add_action method you
   showed in the child theme function with the priority argument set to 11. Then
   in the parent theme I use add_action to enqueue the theme style(which pulls in
   the child style).
 * examples:
    parent theme functions.php
 *     ```
       function register_scripts(){
       	...
       	wp_enqueue_style( 'bootstrap-css', get_template_directory_uri() . '/css/bootstrap/bootstrap.min.css' );
       	wp_enqueue_style( 'bootstrap-theme-css', get_template_directory_uri() . '/css/bootstrap/bootstrap-theme.min.css' );
       	....
       }
   
       add_action( 'wp_enqueue_scripts', 'register_scripts' );
   
       function register_childcss() {
       	wp_enqueue_style( 'style-css', get_stylesheet_uri() );
       }
       add_action('wp_enqueue_scripts', 'register_childcss', 15);
       ```
   
 * child theme functions.php
 *     ```
       add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles', 11 );
       function theme_enqueue_styles() {
       	wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
       }
       ```
   
 * Please let me know if this is crazy, as I’m new to this.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Feature Request: wp_enqueue_style with priority/load order’ is closed
to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 3 participants
 * Last reply from: [ovrzls](https://wordpress.org/support/users/ovrzls/)
 * Last activity: [11 years, 3 months ago](https://wordpress.org/support/topic/feature-request-wp_enqueue_style-with-priorityload-order/#post-4749373)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
