Optimize WordPress performance
WordPress can serve a page in under 200 ms or in several seconds with the same content. The gap comes from what the theme, plugins and database run on each request. This guide covers the application itself; server headers and compression are covered in the general website speed article.
Measure before optimizing
Install Query Monitor on a test environment. It shows the number of SQL queries, their duration, slow hooks and heavy plugins. Add Lighthouse and a TTFB measurement in a private window, where the browser cache does not skew the result.
Record three numbers: TTFB, SQL query count, page weight. Optimize, then measure again with the same profile.
Cache
One page cache plugin is enough. Two cache plugins fighting over the same folder produce stale pages and hard-to-reproduce errors. Set purge after updates, and exclude cart or admin pages if your site depends on them.
Object caching (Redis) is not guaranteed on web hosting. Enable it only if the service is provided and documented by your plan; on a VPS, install it yourself and test reconnection after a reboot.
Browser cache headers for static files avoid re-downloading CSS and images on every visit.
Images and media
Images often make up half of a page's weight.
- Convert to WebP or AVIF while keeping a copy of the originals.
- Resize before upload: a 4000 px photo displayed at 800 px is wasted.
- Lazy-load below the fold, not the hero image.
- Limit the number of sizes WordPress generates, which multiplies files on disk.
Database and code
Limit revisions so each save does not create dozens of rows:
define('WP_POST_REVISIONS', 5);Delete spam comments, trashed posts and expired transients. The wp_options and wp_postmeta tables grow fast with poorly written plugins: inspect them with Query Monitor before cleaning, and back up the database.
On the code side, keep a lean theme, remove unused plugins, defer non-critical scripts, and avoid stacking several page builders or icon libraries.
PHP and scheduled tasks. In KeyHelp, confirm the domain runs PHP 8.4 and that OPcache is enabled. A recent PHP version brings real gains on moderate-traffic sites, provided theme and plugins are compatible: test on a copy.
WP-Cron only fires when a visitor arrives. On a low-traffic site, scheduled tasks run late. Disable DISABLE_WP_CRON only when a real system task calls wp-cron.php on a regular interval.
Check the result
- TTFB is lower and so is the SQL query count.
- The page loads correctly in a private window and on mobile.
- No image is blurry or distorted after conversion.
- The site works after a cache purge, and the admin remains reachable.
- A backup precedes every theme or plugin change.
If the gain is zero, revert the setting: an unmeasured optimization is just one more change to maintain.
Advertisement
Was this article helpful?
Read next
- Migrate a WordPress siteFiles, database, URL rewrite, DNS and SSL: a reversible switchover, step by step.
- Back up WordPressFiles and database belong together: manual method, plugin, off-site copy and a tested restore.
- Secure WordPressUpdates, accounts, configuration and plugins: reduce the attack surface without breaking the site.