Improve Load Times of Wordpress Website
Switch to a minimalist theme like Astra, GeneratePress, or OceanWP
These themes are optimized for speed and performance.
Install a Caching Plugin:
- W3 Total Cache or WP Super Cache are excellent choices.
- Configure them to cache your site’s pages, posts, and database queries.
Optimize Images:
- Use plugins like Smush or EWWW Image Optimizer to compress images automatically.
- Ensure images are in the correct format (WebP/JPEG for photos, SVG/PNG for graphics).
Enable Lazy Loading:
- Use the a3 Lazy Load plugin or enable native lazy loading in WordPress 5.5+ to defer loading of off-screen images and iframes.
Minify CSS, JavaScript, and HTML:
- Use Autoptimize or WP Rocket to combine and minify your CSS, JavaScript, and HTML files.
Leverage Browser Caching:
Add caching rules to your .htaccess
file:
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/javascript "access plus 1 month"
ExpiresByType application/x-javascript "access plus 1 month"
ExpiresByType application/font-woff2 "access plus 1 year"
ExpiresByType application/font-woff "access plus 1 year"
ExpiresByType font/woff "access plus 1 year"
ExpiresByType font/woff2 "access plus 1 year"
ExpiresByType application/x-font-ttf "access plus 1 year"
ExpiresByType application/x-font-opentype "access plus 1 year"
ExpiresByType font/opentype "access plus 1 year"
ExpiresByType application/x-font-otf "access plus 1 year"
ExpiresByType image/svg+xml "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 year"
</IfModule>
Use a Content Delivery Network (CDN):
- Sign up for a free CDN service like Cloudflare and configure it to serve your static files, reducing load times globally.
Optimize Your Database:
- Install WP-Optimize or Advanced Database Cleaner to clean up post revisions, spam comments, and expired transients.
Disable Hotlinking:
Add the following code to your .htaccess
file to prevent other websites from directly linking to your images:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^https?://(www\.)?yourdomain\.com/ [NC]
RewriteRule \.(jpg|jpeg|png|gif)$ - [F]
Use a Lightweight Plugin Set:
- Deactivate and delete any unnecessary plugins.
- Only keep plugins that are essential and well-reviewed.
Disable XML-RPC:
Unless you need it, disable XML-RPC to prevent brute force attacks. You can do this via a plugin like Disable
XML-RPC or by adding this to your .htaccess
:
<Files xmlrpc.php>
Order Deny,Allow
Deny from all
</Files>
Reduce HTTP Requests:
- Minimize the number of scripts and stylesheets.
- Combine and defer loading of JavaScript files using plugins like WP Rocket.
Enable Gzip Compression:
Add the following code to your .htaccess
file to enable Gzip compression:
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
Use a Performance Monitoring Plugin:
- Install Query Monitor or P3 (Plugin Performance Profiler) to identify slow-performing plugins and scripts.
Update WordPress, Themes, and Plugins Regularly:
- Ensure everything is updated to the latest versions to benefit from performance improvements and security patches.
Consider a More Powerful Hosting Plan:
If performance is still an issue, consider upgrading to a VPS or managed WordPress hosting plan with better resources and support.