How to optimize your WordPress site access speed (4)

After a series of operations from the previous blogs, you can see that the loading speed of the website has been significantly improved. But every second is very important. If you want to get as fast as possible, then you need to do some more optimization.

The following methods requires some technical background. You also need to modify the website’s files with a little bit of PHP knowledge. In case of anything unexpected, please make sure that you have made a complete backup of the website.

Paginate long articles

Readers prefer long, in-depth articles. And long articles can even rank higher in search engines. But if you are publishing a long article with a lot of images, which may affect the page loading time, you should consider splitting it into multiple pages.

WordPress has a built-in feature for this purpose. Just insert the <!––nextpage––> tag where you want to paginate. If you want to continue paginating, just insert it again.

Reduce external HTTP requests

Many WordPress plugins and themes load various files from other sites, including scripts, style files and images from external sources such as Google, Facebook, analytics, and more.

It’s okay to use a small amount of external files. These files are optimized and load quickly. So using external links is faster than placing them on your own server.

But if you use a plugin that has too many such requests, it will obviously slow down the entire site.

You can reduce these external HTTP requests by disabling scripts and styles or by combining them into a single file.

Reduce database calls

Note: This step is a bit difficult. You need to have some basic PHP knowledge and understand the WordPress template file.

Unfortunately, there are a lot of poor-quality themes on the market. They ignore the standard practice of WordPress and make direct calls to the database or make too many unnecessary requests to the database. This will cause the workload of the server to increase suddenly and the server will run slowly which will affect the speed of the overall website.

Even if the subject of the encoding specification is likely to call the database just to get the basic information of the blog.

In this example, every time you see <?php, it means that a new database call has started:




There is no way to blame the theme developers because they have no way of knowing what language your site will use.

But if you’re using sub-theme to make custom modifications to your site, you can replace that code with your specific information to reduce calls to the database.




Browse your parent theme to find places where you can be replaced database calls with static information like the example above.

Optimize the WordPress database


After a WordPress site has been running for a while, your database will generate a lot of information that you may no longer need. To improve performance. You should optimize your database and remove information that you no longer need.

With the WP-Sweep plugin you can easily optimize the database. You can use it to clean up the WordPress database, delete the articles in the recycle bin, fix the version, no longer used tags and so on. You can also use it to optimize the database structure with one click.

Limit the number of revisions of published content

Publishing the revised version of the content will take up your database space, and some users think that the revised version will also affect some plugin database queries. If the plugin does not specifically exclude the revised version of the content, it may cause the website to slow down due to unnecessary searches.

You can easily limit the number of revisions for each article. Just add the following line of code to the wp-config.php file in the root of the website.

define( 'WP_POST_REVISIONS', 4 );

This line of code means that the system only saves the latest 4 revisions of each article or page, automatically discarding the previous older version.

Disable hot links in content

If you are currently creating high quality content for your website. Then unfortunately your content might soon be stolen.

One phenomenon in this situation is that other websites serves images directly from the URLs on your website, rather than uploading them to their own servers. In fact, they are stealing your bandwidth and you are not getting any traffic.

You can add the following code to your .htaccess file to block image hot links from your website.

#disable hotlinking of images with forbidden or custom image option
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yoursite.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?google.com [NC]
RewriteRule \.(jpg|jpeg|png|gif)$ – [NC,F,L]

Conclusion

That concludes our series blogs on optimizing WordPress site loading speed. I hope these blogs can help you learn some useful tips for WordPress loading acceleration.

Try some of these methods and techniques. Compare the speed before and after the website optimization and tell us the results of your comparison test in the comments!