WordPress access to open a few ways to solve the slow

Source: Internet
Author: User

Recent WordPress website access is particularly slow, there is time to load a minute to fully open, initially suspected of a server problem, after a multi-test, or did not find the reason.         Later, through the tool to detect the browser has been loading fonts.googleapis.com, only to find that the original is Google's external chain of resources affecting the speed of the site! WordPress A lot of themes with Google's services, Google is now massively shielded, the speed has been affected. WordPress since 3.9+ version joined Google Fonts, and recently Google in China is inaccessible, so, if it is in the login state to open your WordPress site, it will be very slow, because the font file can not be loaded at all.         If you are not logged in and your subject is not a foreigner's theme, it is generally normal. Solution: Come out of the problem to solve, in the celestial, since you have to endure, then change a way of thinking. The following workaround, the idea is to prohibit the loading of Google Fonts, the second is to replace the loading source. Described below: Method one: "plugin" prevents wordpress background loading Google Fonts installation enabled Disable Google Fonts or Remove Open Sans font Link from WP core its can be in one.         There's nothing to say. Method Two: "Code" directly in the functions.php file Add code network has a lot of code, the following can be referenced below, the specific effect is not confirmed:
 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 ' = = = $co ntext && ' 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 Three: "Code" replaces the open sans font's load source open the file in WordPress code wp-includes/script-loader.php file, search: fonts.googleapis.com find this line of code: $open _ Sans_font_url = "//fonts.googleapis.com/css?family1=open+sans:300italic,400italic,600italic,300,400,600& subset= $subsets "; replace the fonts.googleapis.com with fonts.useso.com. WordPress has a lot of foreign themes have used Google's fonts, including the WordPress background itself is also in use, if Google is blocked, will lead to the use of WordPress website slow. Because each page switch needs to be fonts.googleapis.com, this link will be blocked because of Google. The solution of the front desk is to start from the theme, comments related to CSS, the background method is as follows: Remove WordPress backstage Google Font API link is the annual GFW block Google's time period, children's shoes do not feel the background slightly card it? That's because WordPress uses the Google font API, the workaround is to temporarily remove the font file link.
function Remove_open_sans_from_wp_core () {

Wp_deregister_style (' Open-sans '); Wp_register_style (' Open-sans ', false); Wp_enqueue_style (' Open-sans ', ');} Add_action (' init ', ' remove_open_sans_from_wp_core ');

Add this code to the functions.php file at the end of the topic directory.

WordPress access to open a few ways to solve the slow

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.