Let WordPress fly up, speed up the basic skills of WP

Source: Internet
Author: User
Keywords WordPress

Intermediary transaction http://www.aliyun.com/zixun/aggregation/6858.html ">seo diagnose Taobao guest cloud host technology Hall

WordPress version of the more, more and more powerful, of course, more and more bloated, how to let WordPress run smoother, let others quickly open your site page is critical. In the previous article: Accelerated WordPress: The Gravatar avatar cache to the local, we mentioned the Avatar optimization, then today will bring more optimization methods.

The optimization method is a large pile, nothing more than through the following points:

General Front-End performance optimization

Whether your site is based on what background technology to achieve, when visitors visit, always generate regular HTML, CSS, JavaScript and other files sent back to the client. To speed up your site, you can first optimize from the front.

Front-End performance optimization is a very deep thing, there are many techniques and methods, but you may be a webmaster rather than professional front-end engineers, so here I only summed up a few basic but very effective front-end performance optimization techniques:

Compressed pictures: The downloading of pictures takes up a lot of time while the page is open, and if you compress these pictures or other tricks (such as lazy load), you can reduce the time. Practice has proved that 80% of JPG image compression, not only to ensure that the naked eye can not see the quality problems, but also reduce some of the size of the PNG format pictures, you can use Tinypng to compress.

Merged files: Here the file is mainly refers to CSS, JavaScript files, page every more than one CSS, JavaScript file, browser will be more than one HTTP request, there will be more than one wait time. Ideally, there is only one CSS, JavaScript file, and compression to make its files as small as possible, this suggestion to use WP minify plug-ins. If you have the ability, can also merge the icon, some small pictures merged, made CSS Sprite.

Using CDN: If your server is in Beijing, Beijing will be very fast, but visitors in Guangdong may feel slow due to distance and line problems. Mature CDN service providers all over the country will have servers, if you put the static file above, Guangdong area visit your website, will download files from the server near Guangdong, and CDN server and broadband for downloading to do the optimization, speed will generally exceed your server, so you can greatly speed up, At present, it is generally recommended to use seven cattle cloud storage to speed up static files, there are WordPress plug-ins: Seven Cattle mirrored storage WordPress plug-ins. WordPress Theme Station is used to shoot the cloud storage, see the bottom of the site information.

For ordinary webmaster, understand these can be, the following to talk about the optimization of the WordPress site.

Installing Cache Plug-ins for WordPress

Caching is a very important thing to improve speed. When you visit a Web site, the cache optimization, will be some pictures and CSS, JS files cached to your computer. The next time you visit, the browser finds that the files in the cache are not expired, and immediately calls from the cache, and it is no longer downloaded from your server. This way, you just need to download a few KB of the text you write on the OK, of course, the speed of the opening quickly.

WordPress cache, to see your server support level, if your server has installed memory cache These components, install the Memcached plug-in is the most optimized, if it is a virtual host, it is recommended to install WP Super cache.

Caching using. htaccess files

The surface is cached by installing Plug-ins, if you do not want to install Plug-ins, you can use the following method to cache.

Modify the following code according to your requirements and place it in the. htaccess file below the root directory of your WordPress site:

# Cache Valid 1-year header set Cache-control "max-age=29030400, public" # cache valid 1-week header set Cache-control "max-age=604800, Publi C "# Cache valid 2-day header set Cache-control" max-age=172800, proxy-revalidate "# cache valid 1-minute header set Cache-control" max-age=60 , Private, Proxy-revalidate "

The above code makes the simple annotation, the cache time mainly relies on the following max-age parameter, is in the second as the unit, the cache time above parameter is to cache the file type.

Note that while caching is good, it is not the longer the cache time. Some static files, long time will not change their content, you can set a longer time. Some dynamic files, often modified, you need to set a shorter time. Once had a friend's blog one months did not update, asked him to know is the cache settings are wrong, the result of opening the time is still a long time before the content.

Reduce database queries

Dynamic Web sites are sure to make some queries on the database, and each query, to establish a database connection, and then wait for the database to return data and output. This process will be a waste of time. WordPress, there are a lot of unnecessary inquiries and the use of features, remove these can speed up.

You can use this code to see how many queries you have built in WordPress, you can copy it to the functions.php file under the theme directory, you can see the information at the bottom:

Add_action (' Wp_footer ', ' wpjam_page_speed '); function Wpjam_page_speed () {Date_default_timezone_set (get_option (' timezone_string ')); $content = ' ['. Date (' y-m-d H:i:s T '). ' ] '; $content. = ' page generation time '; $content. = Timer_stop ($display = 0, $precision = 2); $content. = ' query '; $content. = Get_num_queries (); $content. = ' Times '; if (! Current_user_can (' Administrator ')) $content = ""; Echo $content; }

As for how to do this optimization, in my favorite boiled fish have a lot of skills to turn off useless features, you can follow your own needs to search.

Find a reliable mainframe.

Of course, the most important thing is to find a reliable host, the first is recommended for the record to choose a domestic host, seemingly the record is not how difficult, but the process wait a little longer. WordPress Theme Station is currently using the Aliyun server, the effect is very good! The author: Boiled fish, respect for the work of others, reproduced please indicate from: http://www.wpmee.com

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.