2

When user is logged in WP add in its footer this CSS:

<link rel='stylesheet' id='open-sans-css'  href='//fonts.googleapis.com/css?family=Open+Sans....' type='text/css' media='all' />

That style is not registered inside my theme, if I change my theme I still have that file called in any theme, it is somewhere inside WP core files.

How to remove it?

  • 2
    it is probably one of your plugins – Mark Kaplun Sep 19 '14 at 6:12
  • I deactivated all my plugins and checked again, and it is still in use. Like @Caleb said it's not a plugin. – Advanced SEO Sep 22 '14 at 4:52
  • In 2017 it is in Jetpack – Mike M Dec 27 '17 at 23:55
3

WP Core actually uses Open Sans font; it's not a plugin. there is a plugin that removes it, but you can probably simply dequeue or deregister it.

adding this to functions.php should work; if you want it removed from the backend as well, hook into the admin_print_styles action.

function dequeue_opensans_css() {
    wp_dequeue_style( 'open-sans' );
}
add_action( 'wp_enqueue_scripts', 'dequeue_opensans_css', 999 );

if it's in the footer, change the add_action() line:

add_action('wp_footer','dequeue _opensans_css',1);

untested, but that should work.

  • Cold you please provide me more informations about how exactly I should dequeue or deregister it? – Advanced SEO Sep 22 '14 at 4:48
  • edited answer with example. – Caleb Sep 23 '14 at 0:15
  • I tried your code, and it does not work I still have that open-sans-css linked. But, I had one more css linked from one my plugin and I successfully removed it using same pattern you provided. Why than it is not working for WP Core CSS? – Advanced SEO Sep 23 '14 at 5:57
  • is the code appearing in the head tags, or is it towards the bottom? – Caleb Sep 23 '14 at 12:17
  • It is at the bottom, in wp_footer section. – Advanced SEO Sep 23 '14 at 13:01
1

Add the following to your functions.php

function replace_admin_open_sans() {
    wp_deregister_style( 'open-sans' );
    wp_register_style( 'open-sans', false );
    wp_enqueue_style( 'open-sans', '' );
}
add_action( 'init', replace_admin_open_sans');  

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.