Wordpress prohibits loading of google Fonts, resolving abnormal and slow page opening

Source: Internet
Author: User

1. Discover problems

Recently, it was quite difficult to access google servers in China, but the speed was still relatively low.
The background was opened very quickly. It took 20 seconds to open it suddenly recently. Every page was like this, and it was almost collapsed.

The following error occurs when you press the console option to open the debugging mode of the browser:

That is, this error:

GET http://fonts.googleapis.com/css? Family = Open + Sans % 3A300italic % 2C400italic % 2C600italic % 2C300% 2C400% 2C600 & subset = latin % 2Clatin-ext & ver = 3.9.1 net: ERR_CONNECTION_TIMED_OUT

Note is loading google Fonts encountered trouble, loading the font code location is in (wordpress \ wp-Des \ script-loader.php 600th line ).

2. Solution: disable him and do not load him.

Add the following code to the topic functions. php file:


// Disable google font loading
Function remove_open_sans_from_wp (){
Wp_deregister_style ('Open-sans ');
Wp_register_style ('Open-sans ', false );
Wp_enqueue_style ('Open-sans ','');
}
Add_action ('init ', 'remove _ open_sans_from_wp ');

Page loading speed restored to normal

If the wordpress website reports an error after changing the style.css or function. Php file, it cannot be opened, or the image upload fails when the document is created. An error occurred while saving the wordpress file encoding. Open it in Notepad. When saving the file, replace the original file with the original encoding format of the website.

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.