⏲️ Estimated reading time: 7 min
How to Make Your Blog Fly, Your PageSpeed Fly ✈️- Full Optimization Plan. Stack: VPS Hostinger + cPanel/Apache, Cloudflare, W3 Total Cache, GeneratePress + GenerateBlocks, Yoast.
Organized in 3 levels: “Today in 30–60 min”, “This week”, “Pro level”. Includes code snippets for LCP, GP hooks, Cloudflare rules, .htaccess, and WP-CLI.
1) Today (30–60 min): biggest wins
A. Cloudflare – instant settings (free plan)
- Brotli: ON
- HTTP/2 + HTTP/3 + 0-RTT: ON
- Early Hints (103): ON
- Always Online: OFF (no benefit in PSI, just downtime)
- Auto Minify: HTML+CSS+JS ON (disable minify in W3TC to avoid duplication)
- Rocket Loader: OFF (breaks INP + AdSense scripts)
- Cache Tiered: ON (origin shielding)
- Polish/AVIF (if Pro plan): ON choose Lossless or moderate Lossy
Cache Rules (3 useful ones)
- Bypass for admin, login & previews
IF: (URI Path contains "/wp-admin" OR "/wp-login.php" OR "preview=true")
THEN: Cache Level = Bypass
- Bypass for sitemap & robots
IF: (URI Path matches "*sitemap*.xml*" OR "/robots.txt")
THEN: Cache Level = Bypass
- Cache Everything for public HTML (edge TTL 1h)
IF: Hostname in ("andreiflorin.ro","helpzone.blog") AND
NOT (URI Path contains "/wp-admin" OR "/login" OR "/cart" OR "/checkout" OR "preview=true")
THEN: Cache Level = Cache Everything; Edge TTL = 3600s; Browser TTL = Respect Existing Headers
Note: keep “Bypass Cache on Cookie” for WP cookies (Cloudflare does this on some plans; use Page Rules otherwise).
B. W3 Total Cache – clean, no duplication
- Page Cache: Disk Enhanced ON
- Preload: OFF (edge cache handles it; enable later for “warm” strategy)
- Opcode Cache: OPCache at PHP level (enable in cPanel)
- Object Cache: ON if Redis/Memcached available, otherwise OFF
- Database Cache: OFF (usually slows down)
- Minify: OFF (Cloudflare handles minify)
- Browser Cache: ON
- Expirations: CSS/JS → 7 days; Images → 30 days; Fonts → 30 days
- CDN: OFF if only Cloudflare proxy is used
Critical exclusions (for INP + Ads)
Exclude from defer/delay:
adsbygoogle.jsgtag/jswp-emoji-release.min.jsjquery.min.js(exclude only if older scripts break with defer)

C. LCP: hero image with highest priority
Real PSI target: LCP < 2.5s on mobile. Usually the hero/featured image. Load it early, no lazy.
1) Register dedicated LCP size (functions.php)
add_action('after_setup_theme', function () {
add_image_size('lcp-desktop', 1536, 864, true);
add_image_size('lcp-mobile', 768, 432, true);
});
2) Disable lazy for the first image
add_filter('wp_lazy_loading_enabled', function ($default, $tag_name, $context) {
if ($context === 'the_content' || $context === 'wp_get_attachment_image') {
static $first = true;
if ($first) { $first = false; return false; }
}
return $default;
}, 10, 3);
3) Preload LCP image via <link rel="preload">
add_action('wp_head', function () {
if (is_front_page() || is_home() || is_singular('post')) {
$img_id = 0;
if (is_singular('post')) {
$img_id = get_post_thumbnail_id(get_the_ID());
} else {
$front_post = get_option('page_on_front');
if ($front_post) $img_id = get_post_thumbnail_id($front_post);
}
if ($img_id) {
$src = wp_get_attachment_image_src($img_id, 'lcp-desktop');
if (!empty($src[0])) {
echo '<link rel="preload" as="image" href="'.esc_url($src[0]).'" imagesrcset="'.esc_attr(wp_get_attachment_image_srcset($img_id, 'lcp-desktop')).'" imagesizes="(max-width: 768px) 768px, 1536px" fetchpriority="high" />'."\n";
}
}
}
}, 1);
4) Hook in GeneratePress (generate_after_header)
<?php
if (is_front_page() || is_singular('post')) {
$img_id = is_singular('post') ? get_post_thumbnail_id(get_the_ID()) : get_post_thumbnail_id(get_option('page_on_front'));
if ($img_id) {
$img = wp_get_attachment_image_src($img_id, 'lcp-desktop');
$w = $img ? $img[1] : 1536; $h = $img ? $img[2] : 864;
$srcset = wp_get_attachment_image_srcset($img_id, 'lcp-desktop');
$sizes = '(max-width: 768px) 768px, 1536px';
echo '<figure class="hero-lcp" style="margin:0">';
echo '<img src="'.esc_url($img[0]).'" srcset="'.esc_attr($srcset).'" sizes="'.esc_attr($sizes).'"
width="'.intval($w).'" height="'.intval($h).'"
decoding="async" fetchpriority="high" alt="'.esc_attr(get_the_title()).'">';
echo '</figure>';
}
}
?>
No lazy on LCP. Add width/height to avoid CLS.
D. Fonts – no FOIT, no blocking
- Prefer system font stack (zero preload).
- If custom font → self-hosted WOFF2 + preload:
add_action('wp_head', function () {
echo '<link rel="preload" as="font" href="'.get_stylesheet_directory_uri().'/assets/fonts/Inter-Variable.woff2" type="font/woff2" crossorigin />'."\n";
}, 1);
E. Ads & INP/CLS
- Reserve space with fixed container:
.ads-slot { display:block; width:100%; max-width:728px; margin:16px auto; }
.ads-slot:before { content:""; display:block; aspect-ratio: 728/90; }
- Avoid aggressive Auto Ads on mobile.
- Exclude AdSense scripts from delay/defer.
2) This week: structural optimizations
A. Images – responsive + AVIF/WebP
add_action('after_setup_theme', function () {
update_option('large_size_w', 1200);
update_option('large_size_h', 0);
add_image_size('content-wide', 1200, 0, false);
add_image_size('card-thumb', 480, 270, true);
});
Use ShortPixel/Imagify/EWWW to bulk convert to WebP/AVIF.
B. Critical CSS
- GeneratePress → Inline print method.
- Use a Critical CSS plugin for Above-the-Fold.
C. Clean up JS/CSS
- Use Asset CleanUp or Perfmatters to disable unused scripts/styles.
- Disable emoji & embeds:
add_action('init', function () {
remove_action('wp_head', 'print_emoji_detection_script', 7);
remove_action('wp_print_styles', 'print_emoji_styles');
remove_action('wp_head', 'wp_oembed_add_discovery_links');
remove_action('wp_head', 'wp_oembed_add_host_js');
});
D. Server tuning
- OPcache: enable and configure properly.
- PHP-FPM: adjust pools based on RAM.
- MariaDB: optimize InnoDB buffer pool.
E. Cron & WP-CLI
wp media regenerate --yes --only-missing
wp post delete $(wp post list --post_type='revision' --format=ids)
wp post delete $(wp post list --post_status='auto-draft' --format=ids)
wp db optimize
3) Pro level How to Make Your Blog Fly
A. Cache prewarm (preload)
Script to curl top URLs to warm Cloudflare cache.
B. Resource Hints
add_action('wp_head', function () {
echo '<link rel="preconnect" href="https://www.googletagmanager.com" crossorigin>';
echo '<link rel="dns-prefetch" href="//pagead2.googlesyndication.com">';
}, 1);
C. Replace heavy modules
- YouTube embed → lite thumbnail method.
D. Stable Layout (CLS ≈ 0.00–0.02)
- Always set width/height on images.
- Reserve ad slots with aspect-ratio.
- Avoid late-loading bars/popups.
4) .htaccess fallback headers
FileETag None
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/avif "access plus 1 month"
ExpiresByType image/webp "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType font/woff2 "access plus 1 month"
ExpiresByType text/css "access plus 7 days"
ExpiresByType application/javascript "access plus 7 days"
ExpiresDefault "access plus 1 day"
</IfModule>
Header always set X-Content-Type-Options "nosniff"
Header always set Referrer-Policy "strict-origin-when-cross-origin"
Header always set Permissions-Policy "camera=(), microphone=(), geolocation=()"
5) Quick checklist
- Cloudflare: Brotli, Early Hints, HTTP/3 ON
- Cache Rules configured (admin bypass, sitemap bypass, cache everything 1h)
- W3TC: Page Cache ON, Minify OFF, Browser Cache ON
- Hero/LCP image preloaded, no lazy, fetchpriority=high
- Fonts self-hosted or system stack
- Ads slots reserved with CSS aspect-ratio
- Emoji & embeds disabled
- OPcache + PHP-FPM tuned
- WP-CLI scripts for cleanup & DB optimize
⚡ With these, your targets become real: How to Make Your Blog Fly
- LCP < 2.5s
- INP < 200ms
- CLS ≈ 0.00–0.02
🔔 For more tutorials like this, consider subscribing to our blog.
📩 Do you have questions or suggestions? Leave a comment or contact us!
🏷️ Tags: WordPress optimization, PageSpeed Insights, Cloudflare, W3 Total Cache, GeneratePress, Core Web Vitals, SEO performance, LCP optimization, server tuning, WP-CLI
📢 Hashtags: #WordPress #PageSpeed #CoreWebVitals #SEO #Cloudflare #GeneratePress #WebPerformance #Adsense #WebDev #FastWebsite