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?

3
  • 2
    it is probably one of your plugins Commented Sep 19, 2014 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. Commented Sep 22, 2014 at 4:52
  • In 2017 it is in Jetpack
    – Mike M
    Commented Dec 27, 2017 at 23:55

2 Answers 2

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.

5
  • Cold you please provide me more informations about how exactly I should dequeue or deregister it? Commented Sep 22, 2014 at 4:48
  • edited answer with example.
    – Caleb
    Commented Sep 23, 2014 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? Commented Sep 23, 2014 at 5:57
  • is the code appearing in the head tags, or is it towards the bottom?
    – Caleb
    Commented Sep 23, 2014 at 12:17
  • It is at the bottom, in wp_footer section. Commented Sep 23, 2014 at 13:01
0

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 and acknowledge you have read our privacy policy.

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