Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save katmoody/eef4d3e0fbdd70a02d89 to your computer and use it in GitHub Desktop.
Save katmoody/eef4d3e0fbdd70a02d89 to your computer and use it in GitHub Desktop.
<?php
// Remove Open Sans that WP adds from frontend
if (!function_exists('remove_wp_open_sans')) :
function remove_wp_open_sans() {
wp_deregister_style( 'open-sans' );
wp_register_style( 'open-sans', false );
}
add_action('wp_enqueue_scripts', 'remove_wp_open_sans');
// Uncomment below to remove from admin
// add_action('admin_enqueue_scripts', 'remove_wp_open_sans');
endif;
?>

The reason you might not be able to remove the Open Sans font that Wordpress >= 3.8 adds to the frontend is that quite a few WP styles and scripts list 'open-sans' as a dependancy when being registered and enqueued. When you remove the 'open-sans' style the other plugins dependant on it will not load. So you just need to deregister WP's open sans style and register your own, with a false value for the src like below.

Credit to seventhsteel from http://wordpress.org/support/topic/turning-off-open-sans-for-the-38-dashboard

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment