How to remove Additional CSS from loading. It loads as internal style sheet on every page. I am doing this but it is not working. if I
print_r(wp_get_custom_css());
It shows the same css. I want to disable it to load.
add_action( 'wp_enqueue_scripts', 'mywptheme_child_deregister_styles', 11 );
function mywptheme_child_deregister_styles() {
wp_dequeue_style( 'wp-custom-css' );
}
How to remove Additional CSS from loading. It loads as internal style sheet on every page. I am doing this but it is not working. if I
print_r(wp_get_custom_css());
It shows the same css. I want to disable it to load.
add_action( 'wp_enqueue_scripts', 'mywptheme_child_deregister_styles', 11 );
function mywptheme_child_deregister_styles() {
wp_dequeue_style( 'wp-custom-css' );
}
Share
Improve this question
edited Oct 7, 2020 at 6:45
Ahsan Najam
asked Oct 7, 2020 at 5:55
Ahsan NajamAhsan Najam
1333 bronze badges
1 Answer
Reset to default 1That style
HTML is added by WordPress using wp_custom_css_cb()
and it's hooked to wp_head
like so:
add_action( 'wp_head', 'wp_custom_css_cb', 101 );
Which adds the custom/additional CSS in the document head
.
So if you don't want that to happen — or you'd rather add/load the CSS manually, you can add this to your theme functions.php
file:
remove_action( 'wp_head', 'wp_custom_css_cb', 101 );