-
浏览107
-
浏览106
-
浏览99
-
浏览97
-
浏览97
最近好多朋友反应,wordpress 后台变慢 无法打开,一直加载中。前台正常。经查源码原来是:WordPress后台无法正常加载 Google Open Sans 字体;
解决办法如下:
办法一:安装启用 Disable Google Fonts 或者 Remove Open Sans font Link from WP core 其中之一即可。或者如果你没有使用WP自带的官方主题,那你添加下面的代码到当前所用的主题的 functions.php 中即可:
/** * WordPress 后台禁用Google Open Sans字体,解决后台变慢 * http://www.shidehui.com/jingyan/247280.html */ add_filter( 'gettext_with_context', 'wpdx_disable_open_sans', 888, 4 ); function wpdx_disable_open_sans( $translations, $text, $context, $domain ) { if ( 'Open Sans font: on or off' == $context && 'on' == $text ) { $translations = 'off'; } return $translations; }
办法二、将WordPress 后台中的open-sans字体加载源从 fonts.googleapis.com替换为fonts.useso.com 的方法,
将下面的代码添加到主题的 functions.php 即可在后台和登录界面更改字体加载来源:
/** * Plugin Name: shidehui Replace Open Sans * Plugin URI: http://www.shidehui.com/jingyan/247280.html * Description: Change the load address of Open Sans. * Author: Changmeng Hu * Author URI: http://www.shidehui.com/jingyan/247280.html * Version: 1.0 * License: GPL */ function wpdx_replace_open_sans() { wp_deregister_style('open-sans'); wp_register_style( 'open-sans', '//fonts.useso.com/css?family=Open+Sans:300italic,400italic,600italic,300,400,600' ); if(is_admin()) wp_enqueue_style( 'open-sans'); } add_action( 'init', 'wpdx_replace_open_sans' );
查询最新优惠券可加微信号:jlzy696
省钱网快报:大家都在抢什么?点此查看>>>