Support » Theme: Twenty Twelve » V2.6, Make editor not load Google Fonts

  • Alright, updated to WordPress 5.0 and along with it the theme to v2.6. Now, I am using my own font that I’m hosting locally. I am loading my own styles with:

    function mytheme_block_editor_styles() {
        wp_enqueue_style( 'mytheme-block-editor-styles', get_theme_file_uri( '/blocks.css' ), false, '1.0', 'all' );
    add_action( 'enqueue_block_editor_assets', 'mytheme_block_editor_styles' ,100);

    In the block.css I am loading my fonts with:

    @font-face {
      font-family: 'Noto Serif';
      font-style: normal;
      font-weight: 400;
      src: url('fonts/noto-serif-v6-latin-regular.eot'); /* IE9 Compat Modes */
      src: local('Noto Serif'), local('NotoSerif'),
           url('fonts/noto-serif-v6-latin-regular.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
           url('fonts/noto-serif-v6-latin-regular.woff2') format('woff2'), /* Super Modern Browsers */
           url('fonts/noto-serif-v6-latin-regular.woff') format('woff'), /* Modern Browsers */
           url('fonts/noto-serif-v6-latin-regular.ttf') format('truetype'), /* Safari, Android, iOS */
           url('fonts/noto-serif-v6-latin-regular.svg#NotoSerif') format('svg'); /* Legacy iOS */

    However, the editor is still loading the font from Google. The page source has:

    <link rel='stylesheet' id='wp-editor-font-css'  href='' type='text/css' media='all' />

    Now, when inspecting the text elements in the browser, it is using the local font and not the one from Google. so it is loading it locally. How can I get TwentyTwelve to stop adding this line while in edit mode, without modifying core code? My guess is I need to specify in the child theme a URL to override the default one or just stop it from adding that line somehow?

    Mark H.

  • The topic ‘V2.6, Make editor not load Google Fonts’ is closed to new replies.