Google Fonts causes WordPress to open slowly. Solution:

Source: Internet
Author: User
Tags php file

Reasons for WordPress speed problems caused by Google Fonts

WordPress has been added to Google Fonts since version 3.8 + (don't ask me what Google Fonts is), and then click it, because of the recent sensitive cycle (No. 35), Tianchao is pushing, A series of Google websites are thoroughly walled, including Google apis.com where Google Fonts is located. Therefore, if you open your WordPress site in the login status, it will be very slow, because the root cannot load the font file. If you are not logged on and your topic is not a foreigner's topic, it is generally normal.

Solution
The problem should be solved. In Tianchao, since you have to endure it, you can change your mind. The solution below is to prohibit the loading of the Google Fonts, and to replace the loading source. It is described as follows:

Method 1: [plug-in] disables the WordPress background from loading Google Fonts

Install and enable Disable Google Fonts or Remove Open Sans font Link from WP core. Nothing to say.

Method 2: [code] add code directly to the functions. php file

There are a lot of code on the network. For details, refer to the following:

The code is as follows: Copy code
Add_filter ('gettext _ with_context ', 'Disable _ open_sans', 888, 4); function disable_open_sans ($ translations, $ text, $ context, $ domain) {if ('open Sans font: on or off' ==$ context & 'on' ==$ text) {$ translations = 'off';} return $ translations ;} function dw_remove_open_sans () {wp_deregister_style ('Open-sans '); wp_register_style ('Open-sans', false); wp_enqueue_style ('Open-sans ','');} add_action ('init ', 'dw _ remove_open_sans ');

Method 3: [code] replace the loading source of the open sans font

Open the wp-nodes des/script-loader.php file in wordpress code and search: fonts.googleapis.com to find this line of code:

The code is as follows: Copy code

$ Open_sans_font_url = "// fonts.googleapis.com/css? Family1 = Open + Sans: 300 italic, 400 italic, 600 italic, 300,400,600 & subset = $ subsets ";

Replace fonts.googleapis.com with fonts.useso.com.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.