1、 After Google is blocked, WordPress opens the tortoise speed solution
① Temporary settlement
After Google is blocked, when you open the page calling Open Fonts, you can get stuck! If you just found this problem and just planned to further deal with it, you found that the login background has been whiteboard, and you still have to wait?? In fact, you just need to press ESC to display the page. In fact, it is to stop loading Google Open Fonts that have gone out of the way. This method is also applicable to some websites that load CSS/JS slowly. You can bypass loading to view basic content, because sometimes we only need a download link.
② , It's all over
That is to say, the practice of disabling WordPress Google font can be divided into code method and plug-in method:
Code method : Paste the following code into the function template file functions.php ?> Front)
/**Disable Google Online Style (valid for personal testing)**/ function remove_open_sans() { wp_deregister_style( 'open-sans' ); wp_register_style( 'open-sans', false ); wp_enqueue_style('open-sans',''); } add_action( 'init', 'remove_open_sans' );
Plug-in method : At present, WordPress has produced many plug-ins that disable Google or replace Google fonts, such as Disable Google Fonts Wait, you can choose one to try, and then you will know the effect. I won't say more.
The method to check whether it works is simple: open the background → plug-in source code → search fonts.googleapis.com If not, it will be successful!
③ Win win approach
Although disabling this font can achieve the fastest effect, there is a win-win solution: replace it with a usable font library, such as the 360 proxy font library, as follows:
Paste the following code into the functions.php file in the theme directory and save it (paste it to the last one without knowing the location ?> Just before)
//Replace Google Fonts with 360 Open Font Library if (! defined('ABSPATH')) exit; class Replace_Google_Fonts { public function __construct() { add_filter('style_loader_tag', array($this, 'ohMyFont'), 888, 4); } public function ohMyFont($text) { return str_replace('//fonts.googleapis.com/', '//fonts.useso.com/', $text); } } new Replace_Google_Fonts;
This method comes from Su Yang's Blog The same author also packaged a WordPress plug-in, and used whatever he liked. Never use the BB plug-in or the code, and always believe that what he likes is the best!
It seems that there is almost no ink when I write here. Welcome to add it if you are knowledgeable and knowledgeable!