WordPress is a good CMS solution and even better blogging platform, but most sites using WordPress are not maximizing their potential. Performance is one of the important factors of a successful website.
In this article, we have compiled a list of useful tips, tricks, hacks, and plugins that can be used to speed up WordPress and boost its performance.
These tricks are for different skill levels and some might even seem very obvious to you, but please bear with us as we want to satisfy the needs of users on all skill levels. These tricks are very easy to implement, so you should start now.
Cache Complete Generated Pages
WordPress is a PHP script, so everything is dynamic, which means every time a page is loaded, WordPress must execute the queries hence making the site load slow and even crash due to the server load if you experience high traffic. The best solution to this problem is by using static pages.
A plugin called WP Super Cache cache complete generated pages and serve those to your users instead of processing the heavy dynamic queries.
Once you have installed this plugin, you will see a significant decrease in your site load time and be much more effective in the usage of server resources.
Disable Hotlinking and Prevent Leeching
Hotlinking is also known as bandwidth theft. It is when other sites direct link to the images on your site from their articles making your server load increasingly high.
If one site does it, it might not make a significant difference, but there are too many spammers that will do this and that is something your server cannot hold especially if they copy your article with a lot of images.
No matter how good your web host is, it will be slowed down if hotlinking is not prevented. There are a few ways you can disable hotlinking. The first way we will share is through your root .htaccess file where you will place this code below:
#disable hotlinking of images with forbidden or custom image option
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www.)?wpbeginner.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www.)?google.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www.)?feeds2.feedburner.com/anantvijaysoni [NC]
RewriteRule .(jpg|jpeg|png|gif)$ – [NC,F,L]
You can make an image that will replace all hot-linked images that will say Stealing is bad or something so it makes the spammer look stupid.
Remember you must allow your feed otherwise your feed readers would not see any images.
Choose a Good Web Host
This might seem like a very obvious one, but a lot of the time people try to save a few bucks and compromise quality. It is not worth it. Pay the extra few dollars and get a better web host. One that is reliable and has strong servers. We have a beginners guide at WPBeginner where we help you choose the web host for WordPress.
Some good and affordable web hosts:
Split Long Posts into Several Pages
If you are making a mega resource that will require you to list about 100+ resources and you will have 100+ images in the post. It is best that you split the post into multiple pages, so each page loads much faster, and you increase your page views. This is very easy and it is doable from the WordPress admin panel if your theme already has this function. When writing the post you just have to enter the following code when you want to split pages:
You must make sure that your template has the function. Check out the Template tags in the Codex.
Use Excerpts and Limit the Count of Posts Displayed on Blog Page
You should never show full posts on the main blog page because you have 5 or 10 total posts on the same page. If each of your posts is a list post and it is displayed in full-text mode, then it will be very inconvenient for your users because the page will take an immense amount of time and server resources to load. Therefore you must use excerpts and limit the count on how many posts are displayed.
In order to display excerpts, limit the number of posts being displayed on your blog page. You can do that through the WordPress admin panel under the tabs Settings > Reading:
Optimize Your MySQL Database
Optimizing your MySQL Database can make a difference in your load time. There are two ways of doing this. One way is a manual hardcore way. Another way is a plugin. To do it manually, you need to go to phpMyAdmin and select your database.
Then towards the bottom, click check all to select all tables and then towards the centre of the screen, there is a drop-down menu, click optimize tables there. If you don’t want to do it manually then Joost De Valk has a plugin for you. It is called Optimize DB, this plugin does exactly what we mentioned above except you don’t have to mess with phpMyAdmin.
Reduce the Use of External Websites and Scripts
Try to avoid relying on external scripts whether it is directly or through the plugin. Some plugins like MyBlogLog and others can take a lot of time to load depending on the server connection. They can often be the reason for the page not loading properly if you are experiencing high traffic. To display widgets from top directories, Alexa and others in your sidebar only slow your site down. Try to avoid it as much as you can.
Add Expires Header to Static Resources
An Expires header is a way to specify a time far enough in the future so that the clients (browsers) don’t have to re-fetch any static content (such as CSS file, javascript, images etc). This way can cut your load time significantly for your regular users.
You need to copy and paste the following code in your root .htaccess file:
ExpiresActive On
ExpiresByType image/gif A2592000
ExpiresByType image/png A2592000
ExpiresByType image/jpg A2592000
ExpiresByType image/jpeg A2592000
The number 2592000 stands for the number of seconds in a month. You can change that number to anything you desire.
Use WP-CSS
WP-CSS is a plugin that uses a shorthand technique. It GZIP and strip whitespace from your CSS files and allows you to confidently use @import inside a CSS file and not worry about what happens on the user’s end. It will look through your style.css file and put any @import files into it. Using the shorthand technique can make a difference in your site load time because it makes the file size smaller.
Compress JavaScript Files
Reduce Image Sizes
This one is a gimme, but it must be reiterated here. Images help make your blog posts lively, but you do not have to put extremely high-resolution images in your blog posts and even in your web design. The bigger your image, the slower your site will load and the more server resources you will use.
If an article with images gets popular in social media and you get tons of traffic, you can even get suspended from your web hosts if you exceed the limits. Therefore it is best if you have low image sizes. You can obtain this by using a plugin called WP Smush.it. This plugin reduces the image size with minimum quality loss. You can also use this directly from the site Smush.it.
Cache Your Database
WordPress is fully integrated with MySQL therefore when a page is loading, multiple database queries are being executed which takes time. A plugin called DB Cache caches the database query and make the site load much faster.
Split Comments into Pages
Every site has a few articles that went viral. This article generates tons of comments and they can consume an enormous amount of server resources upon each visitor loading the page.
Or maybe your blog is already popular and you are getting a good discussion going in your posts, then it is recommended that you paginate the comments to increase your site loading speed and save server resources. This can be done by going into Settings > Discussion in your WordPress Admin Panel.
Reduce the Number of Database Calls
Database calls make WordPress so dynamic, but sometimes you can live without it. By replacing simple text, you will be able to increase your WordPress speed. To give an example look at your header.php code which looks something similar:
"http://www.w3.org/1999/xhtml" >
"http://gmpg.org/xfn/11">
"Content-Type" content="
'html_type'); ?>;
charset='charset'); ?>" />
This code above is calling useless database queries which you can simply put in as text. Like in the example below:
"http://www.w3.org/1999/xhtml" dir="ltr">
"http://gmpg.org/xfn/11">
"Content-Type" content="text/html; charset=UTF-8" />
By making it slightly less dynamic, you have saved yourself some load time. If you get a custom theme designed for a specific WordPress site then there is nothing wrong with removing these because it will only be used by you.
You can also reduce database calls by doing the following:
Cutting Down the Size of MySQL Database
When writing posts, now WordPress actually autosave which even after the post is saved, the revision articles stay in the MySQL Database. The bigger database also brings the site load time down. If you are not using Revisions then you can remove them by adding the following code to your wp-config.php
define('AUTOSAVE_INTERVAL', 500 ); // seconds
define('WP_POST_REVISIONS', false );
You can also delete unnecessary tables from the Database like:
DELETE FROM wp_posts WHERE post_type = “revision”;
Note: Only do this if you don’t use revisions. If you like to have the revision in WordPress then do not take this action.
Stay Updated with the Latest WordPress Version
Of course, this is a must. You should always stay updated with the latest stable release of WordPress in order to boost the performance of your site. If you don’t do this, you are also putting your site in security risks.
Display Page Loading Time and Queries
In order for you to track how well your site is doing, it is wise to add this code to the footer. If it is a low number then it means your site is at its potential. Just paste this code in order to display page loading time and queries:
1 echo get_num_queries(); ?> queries in seconds.
What tricks do you use to speed up WordPress? Share it with us in the comments. We will add it in the post, so everyone else can use it as well.
Read More:
Source: wpbeginner
This post was published on June 14, 2016 8:58 PM
Okay, let's be honest. Most businesses are in it for the money. A healthy bottom… Read More
In the digital marketing world, Artificial Intelligence (AI) has emerged as a game-changer, reshaping how… Read More
Best tools that manipulate images and videos have become increasingly popular, and face-swapping is one… Read More
What if you could create video content that perfectly aligns with your audience's preferences and… Read More
Hi Friends, Today I am going to share an Secret Strategy that will help you… Read More
Who doesn't love the sweet sound of passive income rolling in? The thought of recommending… Read More
This website uses cookies.
View Comments
Found your post interesting to read. I cant wait to see your post soon. Good Luck for the upcoming update.This article is really very interesting and effective.
Bluehost is ultimately the best website hosting provider with plans for all of your hosting requirements.