on my WordPress site the Google Fonts are loaded via a file in the parent theme and I want to disable loading them. I already tried using WP Plugins but they didnt work.
Currently I just go into the file and place a return statement into the function which loads the fonts. But the problem is that everytime the theme updates, I will have to rewrite the function again.
So now I am looking for a solution with which I can overwrite this function in this specific file from my child themes functions.php (if this is even possible).
I have already tried:
add_filter( 'load_fonts_google', '__return_false' );
remove_action( 'init', 'load_fonts_google' );
if ( function_exists( 'load_fonts_google' ) ) {
/**
* Dequeue Google Fonts.
*/
function load_fonts_google($fonts) {
return;
}
}
function remove_my_parent_theme_function() {
remove_action('after_setup_theme', 'load_fonts_google');
}
add_action('wp_loaded', 'remove_my_parent_theme_function');
NOTE: load_fonts_google() is the function I want to remove/overwrite.
Solved it by using the "OMGF" Plugin from WP