Overview
WordPress performance issues are one of the most common support tickets we see. A site that loaded fine at launch starts crawling six months later — usually because of accumulated posts, unoptimized images, no caching in place, or a hosting environment that was never configured for WordPress in the first place.
This article covers the full stack: browser caching, server-side PHP caching, database optimization, image delivery, and a few less-obvious gotchas that trip up even experienced developers. Whether you’re on shared hosting, a VPS, or our Managed WordPress Hosting, most of these steps apply.
If your site scores below 70 on Google PageSpeed Insights or your Time to First Byte (TTFB) is above 600ms, start here.
Prerequisites
- WordPress 6.0 or later (some plugin UIs differ on older versions)
- Admin access to your WordPress dashboard
- cPanel, Plesk, or SSH access to your hosting account (for server-side steps)
- A baseline speed measurement — run your URL through GTmetrix or PageSpeed Insights before making changes so you can compare results
- A recent site backup — some of these changes affect core behaviour
Step-by-Step Instructions
Step 1: Enable PHP OPcache
This is the highest-impact, lowest-effort change you can make. OPcache stores compiled PHP bytecode in memory so WordPress doesn’t recompile every file on every request. On a busy site, this alone can cut server response time by 30–50%.
In cPanel, go to Select PHP Version (under Software) and make sure opcache is ticked in the extension list. Click Save.
If you have SSH access, verify it’s active:
php -r "phpinfo();" | grep -i opcache
You should see opcache.enable => On. If it’s off, add this to your php.ini:
opcache.enable=1
opcache.memory_consumption=128
opcache.max_accelerated_files=10000
opcache.revalidate_freq=60
📝 Note: On managed WordPress hosting plans at Host & Tech, OPcache is enabled by default. If you’re unsure, open a support ticket and we’ll confirm your PHP configuration.
Step 2: Install and Configure a Page Cache Plugin
Without a caching plugin, WordPress runs dozens of PHP functions and database queries for every single page load — even for identical requests. A page cache saves the fully rendered HTML and serves that instead.
I’d recommend WP Super Cache for most shared hosting users and WP Rocket (paid, ~$59/yr) for anyone who wants a single plugin to handle caching, minification, and lazy loading together. For VPS users comfortable with server config, W3 Total Cache with disk-enhanced mode works well.
For WP Super Cache setup:
- Go to Plugins > Add New, search for WP Super Cache, install and activate.
- Navigate to Settings > WP Super Cache.
- Select Caching On (Recommended) and click Update Status.
- Click the Advanced tab. Enable Cache hits to this website for quick access and Use mod_rewrite to serve cache files.
- Scroll down and click Update Mod_Rewrite Rules.
⚠ Warning: Don’t enable page caching on pages that show user-specific content (cart pages, account pages, checkout). WP Super Cache excludes /wp-admin/ automatically, but you’ll need to manually add WooCommerce pages like /cart/ and /checkout/ to the exclusion list under Advanced > Rejected URIs.
Step 3: Enable Object Caching with Redis or Memcached
Page caching handles full-page requests. Object caching handles repeated database queries within a single page load — things like menu lookups, widget data, and transient API calls. Without it, WordPress re-queries the database for the same data over and over.
Redis is the better choice in 2026 — it supports persistent storage across requests, unlike Memcached.
On a VPS with root access:
# Install Redis
sudo apt install redis-server -y
sudo systemctl enable redis-server
sudo systemctl start redis-server
# Install the PHP Redis extension
sudo apt install php-redis -y
sudo systemctl restart php8.2-fpm # adjust version to match yours
Then install the Redis Object Cache plugin by Till Krüss from the WordPress plugin directory. Go to Settings > Redis and click Enable Object Cache.
Confirm it’s working — you’ll see Status: Connected on that settings page.
📝 Note: Redis is included and pre-configured on Host & Tech Managed WordPress plans. On shared hosting, availability depends on your plan — check under cPanel > Software or ask support.
Step 4: Optimize Images
Uncompressed images are the most common reason a site fails PageSpeed. A 4MB hero image uploaded straight from a camera will tank your score regardless of what else you’ve done.
- Install ShortPixel Image Optimizer or Imagify — both convert images to WebP automatically on upload and can bulk-process your existing media library.
- Enable lazy loading — WordPress has had this built in since 5.5, but confirm your theme isn’t disabling it. Check your rendered HTML for
loading="lazy"on<img>tags. - Set a maximum upload width. Most themes don’t display images wider than 1200px. Add this to your theme’s
functions.phpto automatically resize on upload:
add_filter( 'big_image_size_threshold', function() { return 1200; } );
⚠ Warning: Running a bulk optimization on a large media library (1,000+ images) can time out on shared hosting. Do it in batches of 200–300, or run it during off-peak hours.
Step 5: Minify CSS, JavaScript, and HTML
Minification strips whitespace and comments from your static files, reducing their size. Combining files reduces the number of HTTP requests.
If you’re using WP Rocket, this is under File Optimization in the plugin settings. Enable Minify CSS, Minify JavaScript, and Combine CSS files.
⚠ Warning: JavaScript combination breaks a lot of themes and plugins. Enable it, then click through your site carefully — check the homepage, a post, any contact forms, and your cart if you run WooCommerce. If something breaks, disable JS combination and minify-only instead.
Step 6: Use a CDN
A CDN (Content Delivery Network) caches your static assets — images, CSS, JS — on servers distributed globally, so a visitor in London doesn’t have to fetch files from a Toronto datacenter.
Cloudflare’s free plan covers most WordPress sites well. After setting up your domain on Cloudflare:
- Set SSL/TLS mode to Full (Strict) — not just Full. Using Flexible causes redirect loops with WordPress.
- Enable Auto Minify under Speed > Optimization (or use Cloudflare’s Rocket Loader, though I’d test that carefully — it defers JS and occasionally breaks things).
- Install the Cloudflare WordPress plugin to allow cache purging from your dashboard.
Step 7: Clean Up the Database
WordPress accumulates post revisions, trashed posts, expired transients, and orphaned metadata over time. A database that’s grown to 500MB+ from revisions alone will slow down every query.
Install WP-Optimize or run cleanup manually via WP-CLI:
wp transient delete --expired
wp post delete $(wp post list --post_status=trash --format=ids) --force
wp db optimize
To limit future revision bloat, add this to wp-config.php:
define( 'WP_POST_REVISIONS', 5 );
📝 Note: This only limits revisions going forward. Existing revisions stay in the database until you run a cleanup.
Common Issues & Troubleshooting
Cached pages are showing stale content after updates
This happens when your cache plugin doesn’t purge on publish or save. In WP Super Cache, go to Settings > WP Super Cache > Advanced and make sure Clear all cache files when a post or page is published or updated is enabled. With Redis Object Cache, this is usually automatic. If content still sticks, manually purge from the cache plugin’s dashboard.
TTFB is high even with caching enabled
High TTFB (above 400–600ms) while caching is active usually points to the server, not WordPress. Check whether OPcache is actually running (Step 1 above). If you’re on shared hosting and consistently seeing slow TTFB, resource contention from other accounts on the server may be the real cause — a move to a VPS or managed WordPress plan is the actual fix there.
White screen or broken layout after enabling minification
JavaScript minification or combination is almost always the culprit. Disable JS combination first, clear cache, and test. If that fixes it, leave combination off and use minification-only. If it’s still broken, check your browser console for specific JS errors — they’ll point you to the conflicting script.
Cloudflare redirect loop (ERR_TOO_MANY_REDIRECTS)
This is annoyingly common and almost always caused by setting Cloudflare’s SSL mode to Flexible when your hosting account already has an SSL certificate. Cloudflare sends HTTPS to your server, your server redirects back to HTTPS, and the loop begins. Fix: set SSL/TLS to Full (Strict) in your Cloudflare dashboard. This requires a valid certificate on the origin server — if you don’t have one, install a free Let’s Encrypt cert first via cPanel’s SSL/TLS section.
WP-CLI commands fail with a database connection error
If you’re running WP-CLI as root or a different system user than the one that owns the WordPress files, it can’t read wp-config.php properly. Run WP-CLI as the correct user:
sudo -u cpanelusername wp db optimize --path=/home/cpanelusername/public_html
FAQ
Frequently Asked Questions
Does WordPress caching work with WooCommerce?
Yes, but you need to exclude dynamic pages from full-page caching. At minimum, exclude /cart/, /checkout/, and /my-account/ from your cache plugin’s rules. Most caching plugins (WP Rocket, WP Super Cache) have a WooCommerce detection feature that does this automatically — verify it’s active in your settings.
How do I know if caching is actually working on my WordPress site?
Open your site in a private/incognito browser window and view the page source. WP Super Cache adds an HTML comment at the bottom like . With Redis Object Cache, check Settings > Redis in your dashboard for a Connected status. You can also use GTmetrix and compare TTFB before and after — a working page cache typically drops TTFB by 200–500ms.
Is managed WordPress hosting faster than a regular VPS for WordPress?
It depends on how the VPS is configured. A well-tuned VPS with Nginx, Redis, and OPcache will match or beat most managed platforms. The advantage of managed WordPress hosting is that those optimizations are pre-configured and maintained for you — you don’t need to do any of the server-level work. For most non-technical users, it’s the faster path to a fast site.
How many WordPress plugins are too many?
Plugin count alone isn’t the issue — plugin quality is. A site with 40 well-coded plugins can outperform one with 10 bloated ones. The real problems are plugins that run large database queries on every page load, or that load scripts and stylesheets sitewide when they’re only needed on one page. Use the Query Monitor plugin to identify which plugins are hitting the database heavily.
Will these optimizations affect my WordPress admin area?
No. WordPress and every caching plugin exclude the /wp-admin/ path from page caching automatically. OPcache and Redis object caching do run in the admin, but they speed it up rather than causing issues. The only admin-visible change is that you may need to purge your cache manually after making content or theme changes.