这个问题,相信使用过wordpress的很多小伙伴都会遇到,网上的教程也是有多种办法。大多是安装相关的google谷歌字体禁用插件或是通过在主题当中添加代码禁用Google谷歌字体加载的办法。
发现这些方法对于老版的wordpress可能是有效的,但对于新版却都没有效果。
刚刚发现只有这个办法才能真正终级这个fonts.googleapis.com字体的远程加载。
方法如下:
在你wordpress网站的主题脚本文件function.php当中添加如下代码即可:
// 禁用 Google Fonts
add_action('wp_loaded', 'wp_disable_google_fonts');
function wp_disable_google_fonts() {
ob_start('wp_disable_google_fonts_regex');
}
function wp_disable_google_fonts_regex($html) {
$html = preg_replace('/<link[^<>]*\/\/fonts\.(googleapis|google|gstatic)\.com[^<>]*>/i', '', $html);return $html;
}
你试试看,绝对有效。








![Mysql innodb 系统表损坏带来的问题[Warning] InnoDB: Cannot open table XXX/wp_downloads from the internal data dictionary of InnoDB though the .frm file for the table exists. 终极解决办法](https://nrcs.xyz/wp-content/themes/begin/prune.php?src=https://nrcs.xyz/wp-content/uploads/2023/09/e4165-2023-09-28_102533.png&w=280&h=210&a=&zc=1)


评论