WordPress古腾堡编辑器是WordPress5.0发布后自带的一款WordPress编辑器,不过目前这款编辑器很受争议,加载很慢,甚至连发表文章都困难,
加载慢是因为古腾堡编辑器加载了谷歌字体CSS,所以只要我们禁止加载谷歌字体,速度自然而然就会快些了。
禁止古腾堡加载谷歌字体的方法很简单,把下面代码添加至正在使用的WordPress主题的functions.php里面即可。
// 禁用WP编辑器加载Google字体css
function xintheme_remove_gutenberg_styles($translation, $text, $context, $domain)
{
if($context != 'Google Font Name and Variants' || $text != 'Noto Serif:400,400i,700,700i') {
return $translation;
}
return 'off';
}
add_filter( 'gettext_with_context', 'xintheme_remove_gutenberg_styles',10, 4);
如果这篇WordPress教程对你有帮助,记得关注哦!