WordPress is a great platform that can create a website or blog. And it has become the most popular content management system (CMS) in the world. But there are some reasons WordPress might be slow, and addressing these issues can help you improve WordPress speed and performance.
The first reason is that WordPress was designed for bloggers, not for enterprise users who need more control over their site’s performance and security settings. Second, WordPress doesn’t have any built-in caching which means it has to generate every page from scratch every time someone visits your site — this can make your site slow if you don’t optimize it correctly.
Why is WordPress slow?
Here are some reasons you might need to improve WordPress speed and performance:
- Images are not optimized
- Plugins are outdated and there are too many of them
- Outdated theme
- You are running too many requests
- Outdated version of PHP
- Not using best practices by implementing caching and compression
- Your database is not optimized
- Additional issues
It is always recommended that you use the latest version of the WordPress core files to ensure maximum compatibility.
Every website is a fresh case, and the same techniques might not work equally on another website. But we can single out some optimizations as best practices.
Things to do before you optimize WordPress for speed & performance
You should test your website using some of the online tools available such as GT Metrix, Pingdom Tools, Page Speed Insights, and Lighthouse tools, which can be found in Chrome’s inspect tool.
The Lighthouse tool can give you better insights into page speed and performance, as well as mobile optimization recommendations.
Optimizing the website can lead to overall better performance of your website, and the best place to look for improvements is the GT Metrix Legacy report. Although GT Metrix has changed its appearance to be more Google-Lighthouse-friendly, the legacy report offers more real insights into the website’s performance issues.
To access the GT Metrix Legacy report, you need to create a free account first or log in using your Google credentials. In Account settings, under Analysis options, check Enable Legacy reports.
You can choose to default to Legacy reports. GT Metrix informs you that the Legacy reports do not represent your performance from a user perspective, but are essential when searching for troubleshooting tips and issues.
Legacy GT Metrix report shows the sections that can be improved versus the new GT Metrix report which analyzes the code itself, usually indicating a full re-design of the website.
While this feature is great, it will disappear at some point and the focus should shift to LCP (Largest Contentful Paint) and CLS (Cumulative Layout Shift), and improving those parameters.
The Largest Contentful Paint metric measures how quickly the largest above-the-fold content element is rendered onto your page. You need to identify the largest text block or image (usually hero images), and optimize their load time.
Cumulative Layout shift is focused on measuring visual stability of your website, and helps you prevent unexpected layout shifts, affecting the way users interact with the webpage.
Reducing CLS is essential, since shifting pages can lead to a negative user experience.
WordPress optimization tactics that work
Again, Always make sure you make a backup of your website and database before you make any optimizations!
Optimize your images
Image optimization is, in most cases, the number-one reason for slow website loading. Large and unoptimized images can lead to great page file sizes and significantly reduce page load time.
Using full images that are over 5000px and several MB in size does not do your website any favors.
When you notice the “Optimize images” warning in the GT Metrix Legacy report, you need to check first how image-heavy your website is. You can use the Pingdom tools to generate a report which will show you how many resources the images take.
My recommendation is to use the Smush or Robin image optimizer plugin for the optimization. From my experience, I found they gave the best results when you use separate plugins for separate tasks. Although many caching plugins have image optimization options; I use a separate plugin for image optimization.
When you install the Smush plugin (free version), it scans your media folder for images and offers to Bulk Smush all images.
Upon installation, I usually deactivate the Smush lazy load option, since it can lead to unwanted behavior and can cause images not to appear properly after the optimization.
The only downside is that they limited the free version to 50 images per bulk, so you need to resume the task after every 50 images. The solution to that is the Smush Pro plugin, which does not have any limitations.
Another useful plugin is the Robin image optimizer which allows you to optimize all images that are under 5 MB in the free tier, so there is no need for the resuming process.
Once you install the plugin, you select the working server and click Optimize Now, which then optimizes the images. The process is automatic and requires just your patience.
If you encounter an “Optimize images” warning after you successfully optimized the images, you need to optimize them manually using the recommendation from the GT Metrix Legacy report, which offers you the optimized version to download.
You then replace the image manually on the server using FTP and reload the report to verify the results.
If the image optimization results are not showing immediately, you may experience some caching issues. You need to clear the cache to display the results correctly.
Another image optimization issue is the “Serve scaled images” warning, which needs manual treatment if it is still appearing after the image optimization.
The GT Metrix Legacy report offers you the proper sizing of the images, and you can use any image editor of your choice to scale the images to the size that is required.
After the resizing, you need to replace the images on the hosting manually.
The PageSpeed insights and Google’s Lighthouse may display the warning for “Serve images in next-gen formats,” which usually refers to the WebP format.
Smush Pro has the option to serve images in WebP format, but I recommend using the WebP Expres plugin for this task since it generates copies of all images on your hosting in WebP format, and serves them to users.
This resolves the “Serve images in next-gen formats” for mobile devices. Smush can create a lot of entries in the database and I would not recommend using it, while on the other hand WebP Express is a joy to work with.
WordPress plugin maintenance
The best practice would be to have zero inactive and less than 20 active plugins (20 total). Also, it is recommended that you update plugins to their latest version to ensure maximum compatibility.
If that is not the case, you need to scan the plugins for outdated ones and update them accordingly. If you run into some resource-intensive plugins you may use some alternatives or deactivate them to improve performance.
Theme maintenance
Your active theme handles your website’s good looks, but it can also require you to improve WordPress speed and performance if not updated and optimized.
Usually, some older themes can cause issues, since they are using deprecated code and causing more requests. Updating your theme to the latest version ensures your website is compatible with the latest technology.
When the theme is abandoned and there is no update available, the best suggestion is to use an alternative or reach out to a dedicated developer to re-design the website.
Also, the best practice is to remove unused themes and keep one default WordPress theme for potential troubleshooting issues. You should also check the number of scripts (requests) which theme is using. If the theme is bloated, it’s wise to use some themes which are more oriented towards speed.
Optimize the number of requests
When the website loads, it sends out multiple requests for various JavaScript and CSS files to load to ensure your website is looking the way you want. These requests can be render-blocking and can increase your website’s load time.
Minification is the process of minimizing code and markup in your web pages and script files.
It’s one of the major methods used to reduce load times and capacity usage on websites. Minification dramatically improves site speed and accessibility, directly translating into a better user experience.
The Autoptimize plugin offers JavaScript and CSS file minification and aggregation into a single file, so it dramatically reduces the number of requests sent from the website upon initial loading.
When you activate the plugin, you need to access the JS, CSS and HTML options and check Optimise JS, Optimise CSS and Optimise HTML.
You can also check Aggregate all linked JS-files to have them loaded non-render blocking, as well as Aggregate all linked CSS files?
If this option is off, the individual CSS files will remain in place but will be minified. Checking other options can cause unwanted behavior on the website. You also have the option to exclude the scripts and CSS files you don’t want to be minified.
You can also check out the “Extra” optimization options, where you can resolve how Google Fonts are displayed (to have them as non-blocking resources), remove the WordPress’ core emojis’ inline CSS, inline JavaScript, and an otherwise un-optimized JavaScript file, and remove the query strings (or the ver parameter) from the URLs.
The Autoptimize plugin also has the option for Lazy loading the images and serving them from the ShortPixel CDN server, but the credits that are available on the free tier expire quickly and the option does not work properly afterward.
Another very useful plugin for this task is the WP Rocket plugin, but it works best if you purchase a license and use it as a standalone website optimization plugin.
If you encounter some JavaScript and CSS files that are loaded on pages that don’t require them, you can use the Asset Cleanup or the PerfMatters plugin to determine where the plugins and scripts are loading and deactivate them if unnecessary.
PHP version is outdated
Running your website on the latest version of PHP ensures your website’s fast response and decreases page load time. However, even though the latest PHP versions are 8.0 and 8.1, not all themes and plugins are compatible with them, so the recommended version is still 7.4.
If your website is using some older version, you should update to the minimum recommended version.
If some issues occur while updating the PHP version, it is most likely a conflict with a plugin or theme, since the latest versions are using the latest dependencies, and the outdated plugins/themes are using older dependencies.
Caching and compression
Caching is the process of storing and recalling frequently served data to improve WordPress speed and performance. Since WordPress generates every page from scratch every time someone visits your site, caching helps by serving the static resources to your users from the cache and improving the load time.
Most managed WordPress platforms have caching enabled by default, but on cPanel or similar hosting platforms it is recommended that you install a caching plugin.
You can use WP Rocket, WP Super cache or W3 Total cache for this purpose. You can leave the default settings with enabled caching and it would be enough.
Optimize your database
We often overlook database optimization as a factor in website speed, but sometimes the database can become bloated with post revisions, transient data and spam comments.
You can use the WP-Optimize plugin to check the state of your database. If you notice your database is big, you need to check the WP-optimize report and perform the optimizations that are recommended.
An alternative plugin is WP Sweep, which delves into the database issues in more detail. Instead of executing direct delete MySQL queries, this plugin makes use of the right WordPress delete functions as much as possible.
Bonus optimizations
Another commonly overlooked issue is the WooCommerce cart fragments build-up. It can increase the initial page load time by up to 1 second.
WooCommerce makes an AJAX request to check your cart and update your cart totals wherever your theme shows cart contents (like the header menu).
This AJAX call is made to override caching plugins, which is good, but it takes time.
We can resolve this by using the Disable Cart Fragments by Optimocha plugin which allows you to keep using the caching plugin and you still get to update the cart totals when the cart is not empty.
Note, if products are listed on the front-page, the plugin can break the add to cart functionality.
You can run into “Leverage Browser caching,” “Add Expires headers,” and “Configure E-tags” warnings in your GT Metrix Legacy report. We can resolve these issues by adding a piece of code to the htaccess file on your website.
# START EXPIRES CACHE ExpiresActive On ExpiresByType text/css "access 1 month" ExpiresByType text/html "access 1 month" ExpiresByType image/gif "access 1 year" ExpiresByType image/png "access 1 year" ExpiresByType image/jpg "access 1 year" ExpiresByType image/jpeg "access 1 year" ExpiresByType image/svg "access 1 year" ExpiresByType image/x-icon "access 1 year" ExpiresByType application/pdf "access 1 month" ExpiresByType application/xhtml-xml "access 1 month" ExpiresByType application/javascript "access 1 month" ExpiresByType text/x-javascript "access 1 month" ExpiresByType application/x-shockwave-flash "access 1 month" ExpiresDefault "access 1 month" # END EXPIRES CACHE
# BEGIN Cache-Control Headers <ifModule mod_headers.c> <filesMatch ".(ico|jpeg|jpg|png|gif|swf|pdf|svg)$"> Header set Cache-Control "public" </filesMatch> <filesMatch ".(css)$"> Header set Cache-Control "public" </filesMatch> <filesMatch ".(js)$"> Header set Cache-Control "private" </filesMatch> <filesMatch ".(x?html?|php)$"> Header set Cache-Control "private, must-revalidate" </filesMatch> </ifModule> # END Cache-Control Headers
# BEGIN Turn ETags Off FileETag None # END Turn ETags Off
Ready to improve WordPress speed & performance?
Making sure that your website is properly optimized can make a great impact on your SEO and Google rankings, and overall user experience.
When you make all the suggested changes, the performance of your WordPress website will improve significantly, and you can expect more user retention and lower bounce rates.
The post How to improve WordPress speed & performance: Tips to fix common issues appeared first on GoDaddy Blog.
Source: Go Daddy Garage
Originally posted 2022-09-10 23:07:40. Republished by Blog Post Promoter