Site logo

Archived topic

Unable to Remove Google Fonts using the GP PHP

6 replies · Started by Ken on August 22, 2022

Viewing posts 1–7 of 7

I wanted to get rid of all Google Fonts, including in the Customizer. I used the following php code from GP Knowledgebase in my PG Child PHP and I got the following mess, please see screenshot.

Here are the two codes I used:

add_action( 'wp_enqueue_scripts', function() {
    wp_dequeue_style( 'generate-fonts' );
} );
add_action( 'admin_init', function() {
    add_filter( 'generate_google_fonts_array', '__return_empty_array' );
} );

Please see attached screenshot of result.
I'm going to delete the code now. Hope that's okay.
Thank you for your time and help.
Ken

Hi Ken,

May we know how you added the code?

I added to the GP Child FUNCTIONS PHP file on top.

Screenshot link: https://share.getcloudapp.com/lludRp6X

Please note, I have deleted the code because it messed up my site.
Hope this helps. Thank you.

Do you have a staging site? Can you try re-adding the code at the bottom?

You mean below the following:
<?php
/**
* GeneratePress child theme functions and definitions.
*
* Add your custom PHP in this file.
* Only edit this file if you have direct access to it on your server (to fix errors if they happen).
*/

I should add the code here???
I'll give it a try.

Woo! Hoo! Fernando, That worked! I added the code 'below' the text and all is good. I checked the Typography and there are no Google Fonts.
Problem Solved ٩(^ᴗ^)۶
I'll close this ticket with a smile.

But before I go... I think it would have been nice to add a sentence to that Child Functions PHP saying, "Please add code below this text message" That would have prevented this confusion. Just a suggestion. A little info never hurts.

Thanks again for your help.

You’re welcome Ken! I’ll recommend it to the team.

This archived topic is closed to new replies.