WordPress System Web site access to the slow solution

Source: Internet
Author: User

From the end of May 2013, Google in China is basically inaccessible, Google's official website domain name, Hong Kong domain name can not access, even before the IP access methods are also ineffective, and Google AdSense can not open, I am afraid to do Google Alliance webmaster also to be unlucky. Although no relevant content has been found in the news, Google's services have been blocked across the mainland, in addition to search engine blocked, Google's mailbox (Gmail), calendar, translation (Translate), maps (maps), analysis ( Analytics) and Google AdSense are also affected.

WordPress is the world's largest open-source blog program, and WordPress Most of the theme is the use of Google's online font scheme: Google Fonts. Google services are not stable, resulting in a large number of independent blog fonts can not be loaded, directly resulting in hundreds of thousands of independent blog open slow, serious when even caused the site can not open.

The following 2 workarounds are available to resolve the slow font loading situation

One, 360 website defender's solution

Open the file wp-includes/script-loader.php file in your WordPress code, such as

Search: fonts.googleapis.com Find this line of code:

Replace the call address fonts.googleapis.com with the fonts.useso.com.

After modifying the Save, refresh again, we can find that their website speed has been faster than before some.

Second, install plug-in disable Google Fonts

The installation is complete and enabled.

------------------------------------------------------------------------------prohibit 0.gravatar.com, 1. Gravatar.com Access Cache Acceleration

Sometimes WP front page has been loading 1.gravatar.com, etc., the following provides 2 ways to solve the x.gravatar.com in the loading ....

1. Remove Avatar Display

2. Cache the WordPress gravatar avatar image locally

If you want to cache WordPress Gravatar avatar image Locally, first create a new avatar folder based on the directory of the site, and read and write permissions set to 755.

Some of the message's mailbox may not be registered Gravatar avatar, we need to use a default image instead of such a message person's avatar, a default.jpg picture as the default avatar in the Avatar folder.

Open your subject's functions.php file and edit the content.

Copy and paste the following code into your functions.php Finally, the default is 14 days to update the Avatar picture, you can modify it to a shorter time.

function My_avatar ($avatar) {

$tmp = Strpos ($avatar, ' http ');

$g = substr ($avatar, $tmp, Strpos ($avatar, "'", $tmp)-$tmp);

$tmp = Strpos ($g, ' avatar/') + 7;

$f = substr ($g, $tmp, Strpos ($g, "?", $tmp)-$tmp);

$w = Get_bloginfo (' Wpurl ');

$e = Abspath. ' Avatar/'. $f. " JPG ';

$t = 1209600; Set 14-day, unit: seconds

if (!is_file ($e) | | (Time ()-Filemtime ($e)) > $t) {//The image does not exist or the file is updated over 14 days

Copy (Htmlspecialchars_decode ($g), $e);

} else $avatar = Strtr ($avatar, array ($g + = $w. '/avatar/'. $f. jpg '));

if (FileSize ($e) <) copy ($w. '/avatar/default.jpg ', $e);

return $avatar;

}

Add_filter (' Get_avatar ', ' My_avatar ');

WordPress gravatar Avatar Picture Cached to the local, the path of the picture is no longer the URL of the Gravatar official website, but the local server's picture address.

WordPress System Web site access to the slow solution

Related Article

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.