Skip to content

Instantly share code, notes, and snippets.

@MikeNGarrett
Last active January 10, 2018 14:39
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save MikeNGarrett/8462474 to your computer and use it in GitHub Desktop.
Save MikeNGarrett/8462474 to your computer and use it in GitHub Desktop.
WordPress 3.8 - replace admin Open Sans font with your own version
function replace_open_sans() {
// Kill the original style
wp_deregister_style('open-sans');
// Replace it with your own (just as an example, I included only the 300 weight)
wp_register_style( 'open-sans', 'http://fonts.googleapis.com/css?family=Open+Sans:300' );
wp_enqueue_style( 'open-sans');
}
add_action( 'wp_enqueue_scripts', 'replace_open_sans' );
// Thanks to @timkinnane
add_action( 'admin_enqueue_scripts', 'replace_open_sans' );
@timkinnane
Copy link

Thanks for this!
I found I needed to use the following to replace it in dashboard AND the admin bar.

add_action( 'admin_enqueue_scripts', 'replace_open_sans' );
add_action( 'wp_enqueue_scripts', 'replace_open_sans' );

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