0

I have a code, which includes my custom css file to the of the template:

add_action('wp_enqueue_scripts', 'add_custom_css');

function add_custom_css() {
    wp_enqueue_style('custom-styles',  get_stylesheet_directory_uri() . '/../../../wp-includes/css/custom.css');
}

How can I move my custom.css file to the very bottom of to override some plugin styles?

2
  • That URL isn't going to work. Why are you putting styles in the wp-includes file anyway? – Jacob Peattie Mar 15 '18 at 12:34
  • this URL work's excellent and is this big difference where to put my custom styles? I don't think that I should put custom style to the template folder – paulfcdd Mar 15 '18 at 12:38
3

Set the priority argument on add_action(), the 3rd argument, to something high:

add_action('wp_enqueue_scripts', 'add_custom_css', 20 );

The default is 10, so most styles will be loaded at that priority in the order that the plugins are loaded, so 20 will be after most of them. Increase or decrease that number as required.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.