Archived topic
automatic font changing problem
6 replies · Started by webkingpro on November 1, 2019
i have added custom fonts using this method i added robato and open sans ,but when i save it ,and refresh i can see the same google fonts automaticlaly selected :/
ex: i selected that local robato and open sans font but its automatically changed to google fonts
i wannt to add that fonts from my local server.
thanks
ML
Hi there,
if you followed this article:
https://docs.generatepress.com/article/adding-local-fonts/
Then the fonts you installed locally should be listed separately from the Google font list. If make sure that only your local fonts are chosen within the Customzier then only those will load.
If you need to you can remove Google Fonts altogether:
I cant save that both code, I tried 1 code per one snippet
add_action( 'wp_enqueue_scripts','tu_remove_google_fonts', 10 );
function tu_remove_google_fonts() {
wp_dequeue_style( 'generate-fonts' );
}
add_action( 'admin_init', 'tu_remove_google_fonts' );
function tu_remove_google_fonts() {
add_filter( 'generate_google_fonts_array', '__return_false' );
}
I can only save one code, I wanna remove google fonts loading + from that customizer list, could you please give me one code for that?
If you want to use both snippets then the function names need to be different so for the second code use this:
add_action( 'admin_init', 'tu_remove_google_fonts_customizer' );
function tu_remove_google_fonts_customizer() {
add_filter( 'generate_google_fonts_array', '__return_false' );
}
BUT STILL, the google fonts showing on the list on customizer
Thats odd where are you adding the snippet?
Looks like you're site is getting the fonts locally which is good.