1

I realized that, the customizer's styles are default highest priority because they are somewhat embedded into the page.

I want to store ALL styles in my .scss file which using SASS to manage CSS and compile them.

Is there way to disable or somewhat lower the customizer's style priority level? Its really annoying for developers know and 'd like to code with structured method.

Thanks!

1 Answer 1

0

I'm not familiar with the customizer specifically, but if it does it's style inclusion properly (via wp_enqueue_style), then you can do something like the following in a plugin:

function remove_or_reorganize_styles() {
    if ( wp_style_is('target-style-handle', 'enqueued' ) ) {
        wp_dequeue_style( 'target-style-handle' );
    }
}
add_action('wp_enqueue_scripts', 'remove_or_reorganize_styles', 99);

This assumes that target-style-handle is the handle used to register and enqueue the style and that they did not set their priority to 99. Look in their code to find the handle you need. It should be somewhere with a wp_enqueue_style call.

Priority is set to 99 to (hopefully) occur after everything else has added styles.

If you still want their styles to load ( just late ), then you should be able to still just wp_enqueue_style( 'target-style-handle' ) after you remove it from the que ... and it should now be at the end of the list.

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.