Target: Lighthouse 90+ across all categories. LCP <2.5s mobile, CLS <0.1.
wp-config.php Caching Constants
define('WP_CACHE', true);
define('COMPRESS_CSS', true);
define('COMPRESS_SCRIPTS', true);
define('CONCATENATE_SCRIPTS', false); // false = better compatibility
define('ENFORCE_GZIP', true);
Plugin Stack (Preferred)
| Function | Plugin | |---------|--------| | Caching | WP Rocket | | Image optimization | ShortPixel (WebP conversion) | | CDN | Cloudflare | | Database cleanup | WP-Optimize | | Script management | Perfmatters |
Database Cleanup SQL
Run in phpMyAdmin or via WP-CLI:
-- Remove post revisions
DELETE FROM wp_posts WHERE post_type = 'revision';
-- Remove spam comments
DELETE FROM wp_comments WHERE comment_approved = 'spam';
-- Remove auto-draft posts
DELETE FROM wp_posts WHERE post_status = 'auto-draft';
-- Optimize tables
OPTIMIZE TABLE wp_posts, wp_postmeta, wp_options, wp_comments;
Or via WP-CLI: wp db optimize
WP Rocket Key Settings
- Cache: Enable page caching, cache for mobile
- File Optimization: Minify CSS + JS, combine CSS, defer JS
- Media: LazyLoad images and iframes
- Preload: Preload cache on publish, sitemap-based preloading
- CDN: Connect Cloudflare zone
Image Optimization
- Convert all images to WebP (ShortPixel or Imagify)
- Set LCP hero image with
fetchpriority="high"and a preload link tag - Never lazy-load above-the-fold images
Elementor Performance Settings
| Setting | Value | |---------|-------| | CSS Print Method | External File | | Improved Asset Loading | Enabled | | Font Display | Swap | | Google Fonts | Disable (use local fonts) | | Font Awesome | Load used icons only |