Site logo

Archived topic

Ghost fonts in theme?

10 replies · Started by mariosem on August 15, 2021

Viewing posts 1–11 of 11

Hello,

I've set up my site to use stack fonts. But, when I check with GTMetrix, I get 5 requests from two Google Fonts (PT Sans and Open Sans) that shouldn't be there (I think).

Inspecting my site I get those two fonts in the code, apparently linked to the site title and tagline, but I cannot get rid of them.

Any help would be appreciated.

Thanks,

Mario

Hi there,

I see PT Sans, Open Sans and Google Sans.

The Google sans is coming from the iframe-loaded ads.

The PT sans and the Open sans and their variants, you can check on Appearance > Customize > Typography and check all parts if they're using any. Remove the variants you're not using as it can make the request heavier than necessary. :)

Hi Elvin,

thanks for your reply.

I have checked Customize>Typography, I'm using System Stack everywhere, that's why I cannot figure out where these fonts are coming from...

Can you temporarily disable any caching plugin? So we can check the origin of the font. :)

I'm on WordPress.com, therefore I cannot disable the caching plugin, unfortunately, that's something they manage...

I've tried to remove Google Fonts from the theme using Autoptimize, with no luck. I wonder whether I need to use a php snippet for dequeueing and deregistering style in the typography.php file of GP theme. In it, I see this code section:

if ( ! function_exists( 'generate_enqueue_google_fonts' ) ) {
	add_action( 'wp_enqueue_scripts', 'generate_enqueue_google_fonts', 0 );
	/**
	 * Add Google Fonts to wp_head if needed.
	 *
	 * @since 0.1
	 */
	function generate_enqueue_google_fonts() {
		$generate_settings = wp_parse_args(
			get_option( 'generate_settings', array() ),
			generate_get_default_fonts()
		);

Hi there,

i cannot see any font requests being made by the Theme.

Roboto is being loaded by the Adverts on the page.

Open Sans and PT Serif are being requested by this script in the head of your site:

<script type="text/javascript">
WebFontConfig = {"google":{"families":["PT+Serif:r:latin,latin-ext","Open+Sans:r,i,b,bi:latin,latin-ext"]}};
  (function() {
    var wf = document.createElement('script');
    wf.src = 'https://phastidio.net/wp-content/mu-plugins/wpcomsh/vendor/automattic/custom-fonts/js/webfont.js';
    wf.type = 'text/javascript';
    wf.async = 'true';
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(wf, s);
	})();
</script>

Which is a webfont loader, that looks like its coming from the JetPack plugin

Hi David,

is there a way to avoid these requests, maybe with a code snippet?

Thanks

Nothing you can do about Google Adverts as they are a 3rd party request.

The other issue is something you should ask Jetpack support about, they may have some settings that can disable those fonts.

Thanks, I'll ask them!

You're welcome

This archived topic is closed to new replies.