If we want to offer a good user experience and improve our search engine optimization we must optimize WordPress for offer the best possible load times and speed .
To get it there are many ways to accelerate WordPress but these are the 5 that I consider essential.
1.Use a cache system
One of the handicaps of all content managers is that they must query the database to display the content and this greatly lengthens the waiting times when your site has a lot to offer.
The method par excellence for reduce the number of these queries is offer a static version of your website to visitors until something changes, be it a new entry, a comment or whatever . In fact is essential the use of cache in WordPress period.
The ideal situation is offer dynamic cache, static and memcached .
- Dynamic cache: creates copies of your web's dynamic content and stores it in server RAM.
- Memcached: accelerates calls to databases and APIs, as well as the presentation of pages storing data and objects in memory, thus reducing the number of times that the database is accessed.
In WordPress we have a multitude of strategies and ] cache plugins to get it.
WordPress cache plugins
- WP Super Cache : easy to configure, manages static and dynamic caching, as well as being compatible with CDNs.
- W3 Total Cache : compli configuration, very powerful, ideal for high traffic sites, compatible with CDNs.
- SuperCacher : activate and ready, manage dynamic cache, static, memcached and HHVM, a virtual machine designed by Facebook, is the SiteGround plugin for your hosted plans.
In addition to all this, we should also activate the WordPress internal cache by adding a single line to the file
wp-config .php :
define ( ' ENABLE_CACHE ' true ) ;
2. Distributed Delivery (CDN)
The best way to deliver content immediately to your visitors and search engines is to use a content distribution network or CDN.
What these services do is to host in your cache static versions of your site, spread all over the world which serve your visitors and search engines instead of your dynamic web, thereby greatly reducing load times
In passing, as they deliver your content from servers in several continents, also the times are reduced when delivering the content to the visitor or search engine from the nearest data center .
The CDN more Popular and recommended are the following:
- Amazon CloudFront (AWS) : very popular and powerful Amazon content delivery service; its configuration is not for cowards but it offers very good performance.
- CloudFlare : it has a wide free service, enough for most of the sites and plugin for WordPress; you have to create DNS records in your hosting unless you have it hosted in SiteGround and other collaborating companies, where you do not have to configure anything.
- Swarnify : specialized for images and video; the CDN service for images is free up to 10 Gb.
- Photon : the free image CDN service from WordPress.com that you can activate with the JetPack plugin.
3. Compress and simplify
Browsers are able to show your content, whether it's full or compressed, and one way to optimize your website is to offer the compressed version of your content, plus to minimize its size.
To achieve this you must perform 2 basic actions:
- Compress your website with Gzip : you can do it without the need for plugins – although most activate it – simply adding a few lines to the .htaccess file:
# BEGIN GZIP
<ifmodule mod _ deflate . c >
# END GZIP
4. Optimize the images
The text is really the least important thing on your website, what really marks the differences in loading times on a site is the size and optimization of images and other multimedia content.
You can always apply the strategy of not hosting anything on your site, doing hotlinking from specialized services to upload images (Flickr), video (YouTube, Vimeo) or documents (Scribd, Slideshare) but it is not always possible, so it is convenient to optimize the size of your multimedia content, especially the images, which is what you use the most, since you have images in the design, in the entries and pages, in the highlighted images , etc.
You can apply different strategies, but ideally you use them all in combination, which would go through the following:
- Optimize the images before uploading them : you can use your retouching tool What's favorite, like Photoshop, or online like ImageOptimizer ; It is important that you do not upload images to larger sizes than you are going to show, so if the maximum width of your theme is 650 pixels it is not necessary to upload larger images, and consequently heavier ones. Unless you need transparencies, it is best to use lossy compression formats such as JPG.
- Compress images when uploading them : if you do not have a good image optimization tool on your computer you can always get hold of them plugins as wonderful as EWWW Image Optimizer which compresses and optimizes your images when uploading and also allows you to optimize the ones you already hosted, is an essential plugin in all WordPress.
- Progressive loading : in addition to all the above, the option of progressive loading is very interesting, known as lazy loading which is loading the images as the visitor scrolls ; you can get it easily with such fantastic plugins as Lazy Load or BJ Lazy Load simple and effective.
5. Choose a hosting optimized for WordPress
Any strategy is useless if we do not have our website in a specialized WordPress hosting, although it is true that it is not always easy to distinguish the grain from the straw, because every time you see more (theoretically) WordPress plans. To distinguish them you should not stay in the advertising or the beautiful sentences but check that they really offer specific tools for WordPress .
What you must search is, at least, the following:
- Enough space to host WordPress, plugins, premium themes and your attachments, not thinking about what you need right now but within at least a couple of years. Do not even think about contracting anything below 10 Gb.
- Server cache like Varnish that caches your web in virtual memory.
- Installing WordPress with a safe click, with random generation of passwords, user names and table prefixes.
- Free full migrations.
- Full daily backups.
- Optimized and permanently updated servers.
- Latest versions of PHP and MySQL and being able to change easily. the PHP version.
- Specialized support in WordPress, if possible also from plugins and themes.
As you already know, Help WordPress is hosted on SiteGround a hosting really specialized in WordPress with specific tools, servers optimized for WordPress and also with dedicated and exclusive support for us, which is always appreciated.
There are many more techniques and tricks to optimize W ordPress, and many of us have already seen it in the blog, but these 5 steps are vital and I consider the most important.
What are your tips to optimize WordPress? Do you have any questions?
Surely you know more tips and tricks to optimize WordPress, or maybe you have any questions, share them with the whole community in the comments.