How to get rid of Open Sans and save admin bar?
Well, it isn’t that tricky you may think. You may find a way in the network, it looks like this:
1 2 3 4 |
function your_theme_wp_enqueue_scripts() { wp_deregister_style( 'open-sans' ); } add_action( 'wp_enqueue_scripts', 'your_theme_wp_enqueue_scripts' ); |
Easy, isn’t it? Well yes, but it has a big disadvantage. It will turn off your admin bar, because dashicons and admin-bar styles depends on open sans style sheet. So, what to do? Fortunately it is very easy – register your own Open Sans handle and… set it to nothing. Do something like this:
1 2 3 4 5 |
function your_theme_wp_enqueue_scripts() { wp_deregister_style( 'open-sans' ); wp_register_style( 'open-sans', false ); } add_action( 'wp_enqueue_scripts', 'your_theme_wp_enqueue_scripts' ); |
And that’s it! It works well. You may stop for a moment and ask yourself – why should I do that? Well, you don’t have to. I use it only if I want to register my own Google Fonts handler (which usually includes Open Sans) and I want to make just one call. As I wrote before, when WordPress 4.6 will be available – it won’t be a problem anymore, because WP4.6 drops Open Sans for native fonts.