Happy Halloween! Get 20% off GP Premium with the discount code: HALLOWEEN20

Reply To: Google Fonts and W3C Validator error

Home Forums Support Google Fonts and W3C Validator error Reply To: Google Fonts and W3C Validator error

#213879
Tom
Lead Developer
Lead Developer

Hi there,

I’m not sure if it will work, as Google specifically suggests using the pipe in their example code they supply you. I assume they do this for a reason.

You can convert them using this function:

add_filter( 'generate_typography_google_fonts','tu_convert_font_pipes', 100 );
function tu_convert_font_pipes( $google_fonts ) {
	return str_replace( '|', '%7C', $google_fonts );
}

Adding PHP: https://generatepress.com/knowledgebase/adding-php-functions/