8 Tips On How To Optimize Your Wordpress Website
Wordpress is one of the most widely used CMS platforms powering almost 29% of the Internet. And while in comparison Wordpress is faster than other CMS, it can still be rather slow with the default configuration. Slow websites not only lose visitors, but it can also cost your website it’s Google ranking, since one of the factors that is used in the ranking algorithm is load time. Learn how you can optimize your website with the tips listed down below.
Important: Before making any changes, make sure to create a full back up of your website. You don’t want to lose your data in case something goes wrong.
Analyze your Website
Use Google Pagespeed, Gmetrix or WebpageTest to test your website’s performance, both along with statistics give you recommendations on how to improve your website. It’s always better to use more than one analytics tool to give you the best performance overview. You can compare the data before and after you follow the tips in this article.
Choose a Good Hosting Plan
When looking at what might be slowing down your website, you need to start from the ground up. Your webhosting plan might be the culprit. Analytics tools show your server’s response time; you should compare with websites similar to yours, to see how you measure up.
Before blaming your hosting provider, make sure it’s not your hosting plan. While there are a lot of providers who host their clients’ websites on shared servers along with hundreds of other websites, you might have just chosen the wrong hosting plan for yourself.
Generally, websites that require a lot of storage space and experience often traffic spikes can’t just opt for the cheapest hosting plan. Otherwise, they would suffer from slow loading time and often downtimes. It’s better to invest in a pricier hosting plan, than later on deal with the consequences. And eventually having to move hosting providers or servers.
Install a Fast Theme a Fast Theme
Bulky, image-heavy, poorly coded themes can significantly impact your loading speed. When choosing a theme go for the minimalistic ones in terms of features. Especially try to avoid themes that allow you to make changes directly from the theme options (too much PHP, JavaScript, Iframe can take a while to load). You can always tweak and customize a simpler theme however it suits you through the code. Also try to find designs that have been optimized for desktop and mobile devices, they will overall improve user’s experience significantly.
Be picky with your plugins
Abundance of unnecessary plugins makes your website slow, before installing any plugins make sure that you actually need them. While there are some plugins that act as an improvement, plugins that are poorly coded, send requests to third-party servers and often update your Wordpress database can consume a lot of resources, consequently slowing down your website. It’s not so much the number of plugins you have installed, as much as it is the quality of those plugins.
Monitor your plugins, delete those that you don’t use and check how the newly installed plugins impact your CPU use and do your research before installing any plugins.
Use a cache plugin
Whenever someone visits your website, the whole page has to be built from the ground up, slowing down your website. Cache plugins store a cached copy of your website’s pages, so instead of sending a request to your server which has to load information from your database and then putting it all together into HTML content, the user is served an already available cache copy of the page. Bypassing that whole process greatly reduces the loading time.
There are numerous cache plugins available. I recommend either WP Super Cache or W3 Total Cache. Both of which are free plugins.
Enable Browser Caching and Compression
Browsers locally store cache copies of static files such as images, CSS files, JavaScript libraries etc. That’s why for example, when you visit a website for the second time, it loads faster since your browser already has some of the files and doesn’t need to download them again.
Paste the code down below into your .htaccess file, it specifies how long a particular file should be stored on a computer.
Compression decreases the size of the files sent to the user. The way it works is when a request is sent to your server, it compresses the files before transferring them, then they are decompressed and served to the user. So the size of the data that has to be downloaded is smaller, and as a result it loads faster. There are two types of compression you can use Gzip and Deflate. You can enable compression through your cPanel, if your hosting provider offers it; cache plugin or .htaccess. To enable compression, add the following string of code to your .htaccess file. For Gzip:## EXPIRES CACHING ##
ExpiresActive On ExpiresByType image/jpg "access 1 year" ExpiresByType image/jpeg "access 1 year" ExpiresByType image/gif "access 1 year" ExpiresByType image/png "access 1 year" ExpiresByType text/css "access 1 month" ExpiresByType text/html "access 1 month" ExpiresByType application/pdf "access 1 month" ExpiresByType text/x-javascript "access 1 month" ExpiresByType application/x-shockwave-flash "access 1 month" ExpiresByType image/x-icon "access 1 year" ExpiresDefault "access 1 month" ## EXPIRES CACHING ##
For Deflate:
mod_gzip_on Yes mod_gzip_dechunk Yes mod_gzip_item_include file .(html?|txt|css|js|php|pl)$ mod_gzip_item_include handler ^cgi-script$ mod_gzip_item_include mime ^text/.* mod_gzip_item_include mime ^application/x-javascript.* mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
Optimize your images# Compress text, html, javascript, css, xml AddOutputFilterByType DEFLATE text/plain AddOutputFilterByType DEFLATE text/html AddOutputFilterByType DEFLATE text/xml AddOutputFilterByType DEFLATE text/css AddOutputFilterByType DEFLATE application/xml AddOutputFilterByType DEFLATE application/xhtml+xml AddOutputFilterByType DEFLATE application/rss+xml AddOutputFilterByType DEFLATE application/javascript AddOutputFilterByType DEFLATE application/x-javascript
Large image files can slow down your website since they take longer to load. The more image heavy the page, the longer it takes to load. Thankfully, there are many excellent tools to help you avoid that without compromising your content. Look for tools that compress your images without losing the quality, such as WP Smush.it. Another great plugin is Lazy Load, it enables images to be loaded only when a user scrolls past them.
Empty your trash and clear out revisions
The trash bin acts as a fail-safe system, making it possible to restore anything you deleted, either purposefully or accidentally. However, over time the trash can take up a lot of space. By default, the trash is kept for 30 days, but you can change that setting to any number of days or disable it altogether. To do that add the following string of code to your wp-config.php file.
In the example the days after the trash gets emptied is 10, substitute with any desirable number. And to disable the trash bin, simple put 0.
In addition, Wordpress auto-saves your articles and keeps their revisions. That is done in order for you to not lose your data and be able to go back to previous versions of your posts. But do you really need 15 revisions of your post published years ago? Unlikely. It’s better to delete them and free up your storage.define ('EMPTY_TRASH_DAYS', 10);
Wordpress can save an infinite number of revisions, you can reduce that number to any in the wp-config.php by adding the code below (in this case I reduced the number to 3 revisions):
Or paste the following to disable Wordpress Revision System, if you don’t need it at alldefine( 'WP_POST_REVISIONS', 3 );
Another way you can control your revisions is with plugins and clean up your database is plugins such as WP Optimize or Revision Control.define( 'WP_POST_REVISIONS', false );
Consider Using a CDN
CDN stands for Content Delivery Network, among other benefits such as security and prevention of server crashes, it’s mostly used to speed up a website. In short, it’s a globally dispersed network of data centers, they store your website’s static content (JavaScript libraries, CSS files, multimedia etc.) and reduce the physical distance the data has to travel by serving it from the closest location to your visitors. For most websites this considerably reduces speed and latency. Popular CDN to look into are MaxCDN, Amazon CloudFront and Akamai. W3 Total Cache also has an option to enable CDN.
After you’re done implementing any of the given tips, go back and run your website through one of the analytics tools and see how your website has improved.