Last updated December 13th, 2023 21:55
WordPress is a content management system that can be very fast and stable by default, but many people nowadays solve practically any problem through plugins due to its widespread use. Over time, this turns WordPress into a cumbersome and overloaded system, where it’s not uncommon to wait many seconds for a simple page to load. These users often reach a point where the server returns a 500 internal server error due to insufficient PHP memory limit, or their scripts reach a low PHP max execution time value. Simply put, they don’t have enough time to complete within the set time limit and the server forcefully terminates the script’s operation. So, take a look on optimizing for faster WordPress website loading.
Optimizing WordPress for Faster Website Loading
Basic principles for faster WordPress
It’s important to take care of the system and use simple optimization principles such as:
- Always consider if you really need another plugin to solve your current need or problem.
- Try to keep the number of plugins to a minimum.
- Use a cache plugin (e.g., wp-fastest cache is a proven option).
- If you use a cache plugin, consider a content delivery network (CDN) such as the basic one provided with wp-fastest cache in conjunction with Cloudflare.
- Enable GZIP compression.
- Use images on your website in new formats such as .webp. This significantly reduces the size of images and increases loading speed. You can convert all images to .webp using online converters, but some have limits on the number of images, usually up to 10 images per day. One such converter is available here.
- If possible and your web hosting provider allows it, disable WP CRON.
- Run a test on PageSpeed Insights and follow the guidelines to eliminate any problems found.
Number of plugins
Don’t solve every problem or need with a plugin. Many things can be solved in a different and much more elegant way. Various graphical problems can be solved by adjusting CSS codes, and WordPress functions can be combined instead of using three plugins, you can use just one. Here, more than anywhere else, it is important to think and ask yourself if this or that is really necessary or if it can be solved in a different way when creating a website. Each plugin consumes a portion of the allocated memory, and at some point, you will run out of available memory.
Use Cache plugin
Cache is used to speed up loading of your WordPress content.
WordPress that doesn’t use cache is slower because the system first has to retrieve the requested web page from the database, assemble HTML code from the acquired data, and then present it to the user’s browser. This takes some time, especially if it has to do it again with every single page request.
Cache works by storing the generated page in cache memory, and every time someone requests the same page, WordPress retrieves the already generated content from cache memory and presents it to the user.
This eliminates the more time-consuming process of retrieving data from the database and assembling the page again.
For this reason, when using a cache plugin, it is good to occasionally clear the cache when making major changes or updates to articles or pages. This is done to ensure that real and current data is loaded, not old data stored in the cache memory.
One of the best cache plugins for WordPress is wp-fastest-cache.
I must also mention that wp-fastest-cache plugin works really well with Cloudflare. So, if you set up DNS for your domain with Cloudflare, you can integrate this plugin and use the basic CDN. Believe me, it really makes a difference.
Optimizing WordPress for Faster Website Loading
Enable GZIP Compression
One of the elements that can significantly speed up your website is GZIP compression. There’s no point in describing it again here, but if you want to know more, I’ve already written about it before, including a guide on how to activate it.
So be sure to check it out here: https://blog.jirivanek.eu/cs/en/gzip-comppression/
In short, the content of the .htaccess directives can look like this:
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/json
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/font-sfnt
AddOutputFilterByType DEFLATE font/otf
AddOutputFilterByType DEFLATE font/ttf
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE image/vnd.microsoft.icon
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/html
Deactivate WP CRON
CRON, also known as the automatic task scheduler, takes care of various automated actions in WordPress. These are actions that do not require manual intervention by the website administrator. For example, scheduled post publishing and other actions that need to occur periodically.
The problem with WP CRON, however, is that it is a virtual CRON. It runs every time a user visits the website. If you have a website that receives a lot of traffic, this can have a significant impact on speed because CRON negatively affects page loading and server load.
As stated in the warning at the beginning of the paragraph, if you have a web hosting provider that also has a task scheduler in their administration, it is better to completely disable CRON in WordPress and schedule its execution through the provider’s administration, for example, every half hour.
To disable cron in WordPress, follow these steps:
- Access your website’s files using FTP or a file manager provided by your web hosting service.
- Locate the wp-config.php file in the root directory of your WordPress installation.
- Edit the wp-config.php file and add the following code: define(‘DISABLE_WP_CRON’, true);
- Save the changes to the wp-config.php file and upload it back to your server.
This will disable the WordPress cron and prevent it from running automatically. However, you may need to manually run scheduled tasks using a server-side cron job or a third-party service.
The size of images can be crucial, especially for mobile devices.
Use new image formats on your website, such as .WEBP. These formats offer new compression methods, and as a result, the image size can be up to ten times smaller while maintaining the same display quality. There is a significant difference between someone downloading four 1 MB images or the same images with a size of around 250 KB when using a data connection. You will not only save your website visitors time but also their data plan. Nobody likes websites with video content and images uploaded directly from the mobile phone’s photo gallery on their mobile device.
Online image converters can also be used for image conversion, converting .png or .jpg images to .webp. However, their limitation is usually the number of conversions per day, which is typically around ten images. But if you use three different converters, you have 30 images in the correct format immediately.
For quick conversions of a few images, I use this online converter, for example: https://cloudconvert.com/webp-converter.
Take the web test on pagespeed insight.
Pagespeed insight is an online tool by Google that tests the speed of your website. It provides you with results that show where you are making mistakes and where you can make adjustments to improve your website. It measures website performance, accessibility, recommended practices, and SEO optimization. From the results, it offers possible solutions and suggestions on how to solve the problem. This tool is invaluable for estimating where your website may be struggling the most.
The website is created with care for the included information. I strive to provide high-quality and useful content that helps or inspires others. If you are satisfied with my work and would like to support me, you can do so through simple options.
Byl pro Vás tento článek užitečný?
Klikni na počet hvězd pro hlasování.
Průměrné hodnocení. 0 / 5. Počet hlasování: 0
Zatím nehodnoceno! Buďte první
Je mi líto, že pro Vás nebyl článek užitečný.
Jak mohu vylepšit článek?
Řekněte mi, jak jej mohu zlepšit.
Subscribe to the Newsletter
Stay informed! Join our newsletter subscription and be the first to receive the latest information directly to your email inbox. Follow updates, exclusive events, and inspiring content, all delivered straight to your email.