Skip to content
  • Quick Ref
  • Contact
  • About
wpcanyon.com

wpcanyon.com

Tag: Performance

Deleting, Limiting, and Disabling Post Revisions in WordPress

Posted on August 20, 2025August 20, 2025 By Admin No Comments on Deleting, Limiting, and Disabling Post Revisions in WordPress

Deleting, Limiting, and Disabling Post Revisions in WordPress

WordPress automatically saves post revisions to help you track changes and restore previous versions. However, excessive revisions can bloat your database, slow down your site, and complicate backups. This guide explains how to delete existing revisions, limit the number of revisions saved, or disable them entirely to optimize your WordPress site’s performance.

Quick Fix

  1. Delete all existing post revisions using a simple SQL query or a plugin.
  2. Limit future revisions by adding a line to your wp-config.php file.
  3. Disable post revisions completely by defining a constant in wp-config.php.

Why This Happens

WordPress stores each revision of a post as a separate entry in the database. Over time, especially on sites with frequent edits or multiple authors, these revisions accumulate and increase the size of your wp_posts table. This can lead to slower database queries and larger backups. Limiting or disabling revisions helps maintain a lean database and improves site speed.

Step-by-Step

1. Deleting Existing Post Revisions

You can remove all existing post revisions directly from your database using this SQL command. Run it via phpMyAdmin, Adminer, or any MySQL client connected to your WordPress database.

DELETE FROM wp_posts WHERE post_type = 'revision';

Note: Replace wp_ with your actual database table prefix if different.

2. Limiting Post Revisions

To limit the number of revisions WordPress saves per post, add the following line to your wp-config.php file, ideally just before the line that says /* That's all, stop editing! Happy blogging. */:

define('WP_POST_REVISIONS', 3);

This example limits revisions to the last 3 versions. Adjust the number as needed.

3. Disabling Post Revisions Completely

If you prefer to disable revisions entirely, add this line to your wp-config.php file:

define('WP_POST_REVISIONS', false);

Note that disabling revisions means you lose the ability to revert to earlier versions of your posts.

WP_Config Tweaks

The wp-config.php file controls many core WordPress settings. To manage revisions, use these constants:

Constant Value Effect
WP_POST_REVISIONS Integer (e.g., 3) Limits the number of revisions saved per post
WP_POST_REVISIONS false Disables post revisions completely

Example snippet to limit revisions to 5:

define('WP_POST_REVISIONS', 5);

Code Snippets

Delete Revisions via PHP (Optional)

If you prefer deleting revisions programmatically, add this snippet to your theme’s functions.php or a custom plugin and run it once:

function delete_post_revisions() {
    global $wpdb;
    $wpdb->query("DELETE FROM {$wpdb->posts} WHERE post_type = 'revision'");
}
add_action('init', 'delete_post_revisions');

Important: Remove or comment out this code after running to avoid repeated deletions.

Disable Revisions via Plugin Filter

Alternatively, disable revisions using a filter in your theme or plugin:

add_filter('wp_revisions_to_keep', '__return_zero');

Common Pitfalls

  • Forgetting to backup: Always backup your database before running deletion queries or editing wp-config.php.
  • Wrong table prefix: If your WordPress database uses a custom prefix, update the SQL query accordingly.
  • Plugin conflicts: Some plugins may override revision settings or create their own revisions.
  • Performance impact: Running large DELETE queries on big databases may temporarily slow down your site.
  • Disabling revisions risks: You lose the ability to restore previous content versions if revisions are disabled.

Test & Verify

  1. After deleting revisions, check your database wp_posts table for remaining entries with post_type = 'revision'.
  2. Create or edit a post and verify that the number of saved revisions respects your limit.
  3. If disabled, confirm no new revisions appear after editing posts.
  4. Use plugins like WP-Optimize or Query Monitor to monitor database size and queries.

Works on

This guide works on WordPress sites running on:

  • Web servers: Apache, Nginx, LiteSpeed
  • Control panels: cPanel, Plesk, DirectAdmin
  • Database: MySQL, MariaDB
  • WordPress versions 4.0 and above

FAQ

Q: Will deleting revisions affect my published posts?
A: No. Deleting revisions only removes saved versions, not the current published content.
Q: Can I recover revisions after deleting them?
A: No. Once deleted from the database, revisions cannot be restored unless you have a backup.
Q: Is it safe to disable revisions?
A: It is safe but not recommended if you want to keep track of changes or revert edits.
Q: How do I know how many revisions a post has?
A: In the post editor, WordPress shows the number of revisions in the “Revisions” section or sidebar.
Q: Are there plugins to manage revisions?
A: Yes, plugins like WP-Optimize or Revision Control help manage, limit, or delete revisions.

Wrap-up

Managing post revisions in…

Database & Revisions

Disable emojis and embeds to cut requests

Posted on August 19, 2025 By Admin No Comments on Disable emojis and embeds to cut requests

Disable Emojis and Embeds to Cut Requests in WordPress

WordPress loads emoji and embed scripts by default on every page, which adds extra HTTP requests and can slow down your site. Disabling these features reduces unnecessary resource loading, improving page speed and overall performance. This tutorial shows you how to disable emojis and embeds in WordPress quickly and safely.

Quick Fix: Disable Emojis and Embeds in WordPress

  1. Add code snippets to your theme’s functions.php file or a site-specific plugin.
  2. Clear any caching plugins or server caches.
  3. Test your site to confirm emoji and embed scripts are no longer loading.

Why This Happens

WordPress includes built-in support for emojis and oEmbed content (like YouTube videos, Tweets, etc.) by default. This support loads JavaScript and CSS files on every page:

  • Emojis: WordPress loads wp-emoji-release.min.js and related styles to render emojis consistently across browsers.
  • Embeds: WordPress loads wp-embed.min.js to enable embedding content from other sites and to allow your content to be embedded elsewhere.

While useful for many sites, these scripts add extra HTTP requests and increase page size, which can slow down your site, especially on mobile or slow connections.

Step-by-step: Disable Emojis and Embeds in WordPress

Follow these steps to remove emoji and embed scripts from your WordPress site:

  1. Access your theme’s functions.php file or create a site-specific plugin for custom code.
  2. Add the following code snippet:
<?php
// Disable emojis
function disable_wp_emojicons() {
    // Remove emoji scripts and styles
    remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
    remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
    remove_action( 'wp_print_styles', 'print_emoji_styles' );
    remove_action( 'admin_print_styles', 'print_emoji_styles' );

    // Remove from TinyMCE editor
    add_filter( 'tiny_mce_plugins', 'disable_emojicons_tinymce' );

    // Remove emoji CDN hostname from DNS prefetching hints
    add_filter( 'emoji_svg_url', '__return_false' );
}
add_action( 'init', 'disable_wp_emojicons' );

function disable_emojicons_tinymce( $plugins ) {
    if ( is_array( $plugins ) ) {
        return array_diff( $plugins, array( 'wpemoji' ) );
    }
    return array();
}

// Disable embeds
function disable_wp_embeds() {
    // Remove the REST API endpoint
    remove_action( 'rest_api_init', 'wp_oembed_register_route' );

    // Turn off oEmbed auto discovery
    add_filter( 'embed_oembed_discover', '__return_false' );

    // Remove oEmbed-specific JavaScript from front-end and back-end
    remove_action( 'wp_head', 'wp_oembed_add_discovery_links' );
    remove_action( 'wp_head', 'wp_oembed_add_host_js' );

    // Remove TinyMCE embed plugin
    add_filter( 'tiny_mce_plugins', 'disable_embeds_tinymce' );

    // Remove oEmbed result caching
    remove_filter( 'oembed_dataparse', 'wp_filter_oembed_result', 10 );
}
add_action( 'init', 'disable_wp_embeds' );

function disable_embeds_tinymce( $plugins ) {
    if ( is_array( $plugins ) ) {
        return array_diff( $plugins, array( 'wpembed' ) );
    }
    return array();
}
?>
  1. Save the file and upload it back to your server (if editing locally).
  2. Clear all caches: If you use caching plugins (e.g., WP Super Cache, W3 Total Cache) or server-level caching, clear those caches to see the changes immediately.
  3. Verify changes: Use your browser’s developer tools (Network tab) to confirm that wp-emoji-release.min.js and wp-embed.min.js are no longer loaded.

Common Pitfalls

  • Editing the wrong file: Always back up your functions.php file before editing. Use a child theme or a site-specific plugin to avoid losing changes during theme updates.
  • Caching issues: Changes might not appear immediately if caching plugins or server caches are active. Clear all caches after applying the code.
  • Plugin conflicts: Some plugins may enqueue emoji or embed scripts independently. You may need to check plugin settings or contact plugin authors.
  • Impact on embeds: Disabling embeds means WordPress won’t automatically convert URLs into embedded content. Use this only if you don’t rely on oEmbed functionality.

Works on

Environment Compatibility
Web Servers Apache, Nginx, LiteSpeed, IIS
Control Panels cPanel, Plesk, DirectAdmin
WordPress Versions 4.2 and later (all modern versions)
PHP Versions PHP 5.6 and later

FAQ

Q1: Will disabling emojis break my site’s content?
A1: No, disabling emojis only stops WordPress from loading extra emoji scripts. Emojis will still display using native browser support but may look different on older browsers.
Q2: Can I disable only emojis or only embeds?
A2: Yes. You can remove either the emoji or embed code blocks separately from your functions.php file if you want to disable one but keep the other.
Q3: Will disabling embeds affect Gutenberg blocks?
A3: Yes, disabling embeds removes automatic embed discovery and some embed-related blocks. If you rely heavily on Gutenberg embeds, consider leaving this enabled.
Q4: Is there a plugin to disable emojis and embeds?
A4: Yes, plugins like “Disable Emojis
…
Speed & Security

Preload fonts and critical CSS in WordPress

Posted on August 19, 2025 By Admin No Comments on Preload fonts and critical CSS in WordPress

Preload Fonts and Critical CSS in WordPress

Preloading fonts and critical CSS in WordPress improves your website’s loading speed and user experience by instructing browsers to fetch these essential resources early. This reduces render-blocking delays and prevents flash of unstyled text (FOUT), making your site appear faster and smoother.

Quick Fix: How to Preload Fonts and Critical CSS in WordPress

  1. Identify the fonts and critical CSS files your site uses.
  2. Add <link rel="preload"> tags for fonts and critical CSS in your theme’s functions.php or via a plugin.
  3. Ensure proper as attributes and crossorigin settings for fonts.
  4. Test your site with tools like Google PageSpeed Insights to confirm preloading works.

Why This Happens

By default, browsers discover fonts and CSS files during HTML parsing, which can delay their download and block rendering. Fonts especially can cause a flash of invisible or unstyled text if not loaded early. Critical CSS controls the initial page layout and styling; if delayed, users see unstyled content or layout shifts. Preloading tells browsers to prioritize these resources, reducing delays and improving perceived performance.

Requirements

  • Access to your WordPress theme’s functions.php file or a site-specific plugin.
  • Basic knowledge of HTML and WordPress theme development.
  • Understanding of your site’s fonts and CSS files (check browser DevTools).

Step-by-step: Preload Fonts and Critical CSS in WordPress

  1. Identify Fonts and Critical CSS Files
    Use your browser’s Developer Tools (Network tab) to find font files (e.g., .woff2, .woff) and the CSS file(s) containing critical styles. Critical CSS is usually the minimal CSS needed to render above-the-fold content.
  2. Add Preload Tags for Fonts
    Open your theme’s functions.php file or create a site-specific plugin. Add the following code to insert preload headers for your font files:
    function wp_preload_fonts() {
        echo '<link rel="preload" href="' . get_template_directory_uri() . '/fonts/myfont.woff2" as="font" type="font/woff2" crossorigin="anonymous">' . "n";
    }
    add_action('wp_head', 'wp_preload_fonts');

    Replace myfont.woff2 and path with your actual font file location.

  3. Preload Critical CSS
    If you have a separate critical CSS file, preload it similarly:
    function wp_preload_critical_css() {
        echo '<link rel="preload" href="' . get_template_directory_uri() . '/css/critical.css" as="style">' . "n";
        echo '<link rel="stylesheet" href="' . get_template_directory_uri() . '/css/critical.css">' . "n";
    }
    add_action('wp_head', 'wp_preload_critical_css');

    This preloads the critical CSS and immediately applies it.

  4. Combine Preloads
    You can combine font and critical CSS preloads in one function:
    function wp_preload_assets() {
        // Preload font
        echo '<link rel="preload" href="' . get_template_directory_uri() . '/fonts/myfont.woff2" as="font" type="font/woff2" crossorigin="anonymous">' . "n";
        // Preload critical CSS
        echo '<link rel="preload" href="' . get_template_directory_uri() . '/css/critical.css" as="style">' . "n";
        echo '<link rel="stylesheet" href="' . get_template_directory_uri() . '/css/critical.css">' . "n";
    }
    add_action('wp_head', 'wp_preload_assets');
  5. Test Your Site
    Use Google PageSpeed Insights, WebPageTest, or browser DevTools to verify your fonts and critical CSS are preloaded. Look for rel="preload" tags in the page source and check the Network tab for early loading.

Common Pitfalls

  • Missing crossorigin attribute on fonts: Fonts served from your domain or CDN require crossorigin="anonymous" to avoid CORS issues.
  • Incorrect as attribute: Use as="font" for fonts and as="style" for CSS. Wrong values cause browsers to ignore preloading.
  • Preloading too many files: Only preload critical fonts and CSS to avoid wasting bandwidth and blocking other resources.
  • Not applying critical CSS after preload: Preloading CSS alone does not apply it. You must include a stylesheet link or inline the CSS.
  • Using plugins that conflict: Some optimization plugins may already handle preloading. Check plugin settings to avoid duplication.

Works on

This method works on all major web servers and hosting control panels including:

  • Apache
  • Nginx
  • LiteSpeed
  • cPanel
  • Plesk

Because it uses standard WordPress hooks and HTML tags, it is compatible with almost all WordPress setups.

FAQ

Q: Can I preload Google Fonts in WordPress?
A: Yes, but you must self-host the fonts or use the Google Fonts API preload method carefully. Self-hosting fonts allows you to preload them reliably with rel="preload".
Q: How do I generate critical CSS for my WordPress site?
A: Use tools like CriticalCSS.com, SiteLocity Critical CSS Generator, or plugins like Autoptimize that can extract critical CSS automatically.
Q: Will preloading fonts increase my bandwidth usage?
A: Preloading itself does not increase bandwidth but causes fonts to be fetched earlier. Avoid preloading unnecessary fonts to prevent wasted bandwidth.
Q: Can
…
Speed & Security

Reduce TTFB on budget hosting (OPcache + object cache)

Posted on August 19, 2025 By Admin No Comments on Reduce TTFB on budget hosting (OPcache + object cache)

Reduce TTFB on Budget Hosting (OPcache + Object Cache)

Time To First Byte (TTFB) is a critical performance metric that measures how long it takes for a user’s browser to receive the first byte of data from your server. On budget WordPress hosting, TTFB can often be slow due to limited server resources. This tutorial shows you how to reduce TTFB effectively by enabling OPcache and an object cache, improving your site’s responsiveness without upgrading your hosting plan.

Quick Fix: Enable OPcache and Object Cache

  1. Verify your hosting supports PHP OPcache and enable it in your PHP configuration.
  2. Install and configure a persistent object cache like Redis or Memcached.
  3. Integrate the object cache with WordPress using a suitable plugin.
  4. Test your site’s TTFB before and after to confirm improvements.

Why This Happens

Budget hosting environments typically share resources among many users, leading to slower PHP execution and database queries. WordPress dynamically generates pages by running PHP scripts and querying the database on each request, which increases TTFB.

OPcache caches compiled PHP bytecode, so PHP scripts don’t need to be recompiled on every request, reducing CPU load and execution time.

Object caching stores database query results and other expensive computations in memory, allowing WordPress to serve data faster without repeated database hits.

Combining OPcache with a persistent object cache significantly reduces backend processing time, lowering TTFB even on limited hosting.

Requirements

  • Budget WordPress hosting with PHP 7.4 or higher (PHP 8.x preferred).
  • Access to PHP configuration (php.ini or hosting control panel).
  • Redis or Memcached service available on your server or via your hosting provider.
  • Ability to install WordPress plugins.

Step-by-step Guide

1. Enable OPcache in PHP

Check if OPcache is enabled by creating a phpinfo.php file in your WordPress root directory:

<?php
phpinfo();
?>

Access it via your browser (e.g., https://yourdomain.com/phpinfo.php) and look for the Zend OPcache section.

If OPcache is disabled, enable it by editing your php.ini file or using your hosting control panel’s PHP settings. Add or update these lines:

opcache.enable=1
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000
opcache.revalidate_freq=2
opcache.validate_timestamps=1

Restart your web server or PHP-FPM process if you have control over it.

2. Install Redis or Memcached

Check if your hosting provider supports Redis or Memcached. If yes, enable the service via your control panel or request support.

If you have SSH access and permission, install Redis (example for Ubuntu):

sudo apt update
sudo apt install redis-server
sudo systemctl enable redis-server
sudo systemctl start redis-server

For Memcached:

sudo apt update
sudo apt install memcached
sudo systemctl enable memcached
sudo systemctl start memcached

3. Install and Configure Object Cache Plugin in WordPress

Use a plugin to connect WordPress with Redis or Memcached. Popular options:

  • Redis Object Cache (for Redis)
  • Memcached Redux (for Memcached)

Example: Installing Redis Object Cache

  1. Go to Plugins > Add New in your WordPress dashboard.
  2. Search for Redis Object Cache and install it.
  3. Activate the plugin.
  4. Go to Settings > Redis and click Enable Object Cache.

4. Verify Object Cache is Working

Use the plugin’s status page or install the Query Monitor plugin to check if object caching is active and reducing database queries.

5. Test TTFB Improvement

Use tools like GTmetrix, Pingdom, or WebPageTest to measure TTFB before and after enabling caching.

Common Pitfalls

  • OPcache not enabled: Some shared hosts disable OPcache by default. Confirm with your provider.
  • Redis/Memcached not available: Budget hosts may not support these services or restrict access.
  • Plugin conflicts: Object cache plugins can conflict with other caching or optimization plugins.
  • Incorrect configuration: Ensure Redis/Memcached connection details match your server setup.
  • Not clearing cache after changes: Always flush caches after plugin or theme updates.

Works on

Server Control Panel Cache Support
Apache, Nginx, LiteSpeed cPanel, Plesk, DirectAdmin PHP OPcache, Redis, Memcached

FAQ

Q: Can I enable OPcache on any shared hosting?
A: Not always. Many budget hosts enable OPcache by default, but some restrict access. Check with your hosting provider.
Q: Is Redis or Memcached better for object caching?
A: Both are effective. Redis offers more features and persistence, while Memcached is simpler. Use whichever your host supports.
Q: Will enabling these caches reduce my database size?
A: No, caching reduces query load and speeds up response times but does not affect database size.
Q: How often should I clear OPcache and object
…
Speed & Security

Reduce TTFB on cheap hosting (object cache & OPcache)

Posted on August 19, 2025 By Admin No Comments on Reduce TTFB on cheap hosting (object cache & OPcache)

Reduce TTFB on Cheap Hosting (Object Cache & OPcache)

Time To First Byte (TTFB) is a critical performance metric for WordPress sites. On cheap hosting, slow TTFB can frustrate visitors and harm SEO. The good news: you can significantly reduce TTFB by enabling OPcache and object caching, cleaning up your database, and using a CDN. This guide walks you through practical steps to speed up your WordPress site without expensive hosting upgrades.

Quick Fix

  1. Enable PHP OPcache on your server.
  2. Activate an object caching plugin like Redis or Memcached.
  3. Clean up your WordPress database to remove overhead.
  4. Integrate a CDN to serve static assets closer to users.

Why This Happens

Cheap hosting often uses shared resources and limited server configurations, resulting in slower PHP execution and database queries. Without caching, every page load triggers PHP scripts and database calls from scratch, increasing TTFB. OPcache stores precompiled PHP bytecode in memory, reducing script load times. Object caching stores database query results in memory, cutting down repeated queries. Cleaning the database removes bloat that slows queries. A CDN reduces latency by serving assets from edge servers near visitors.

Step-by-step

1. Enable OPcache

OPcache is a PHP extension that caches compiled script bytecode. Many cheap hosts support it but may not enable it by default.

  1. Check if OPcache is enabled by creating a phpinfo.php file in your WordPress root with this content:
    <?php
    phpinfo();
    ?>
  2. Access yourdomain.com/phpinfo.php and search for “OPcache”. If enabled, you’ll see its configuration.
  3. If not enabled, enable it via your hosting control panel or by adding this to your php.ini or .user.ini file:
    opcache.enable=1
    opcache.memory_consumption=128
    opcache.interned_strings_buffer=8
    opcache.max_accelerated_files=4000
    opcache.revalidate_freq=60
    opcache.fast_shutdown=1
  4. Restart PHP or your web server if possible.

2. Enable Object Cache

Object caching stores database query results in memory, reducing repeated queries and lowering TTFB.

  1. Check if your host supports Redis or Memcached. You can ask support or check documentation.
  2. Install a WordPress plugin for object caching, for example:
    • Redis: Redis Object Cache plugin
    • Memcached: Memcached Redux or W3 Total Cache
  3. Configure the plugin to connect to your Redis or Memcached server. Usually, this is 127.0.0.1 and default ports.
  4. Verify caching is active via the plugin’s status page.

3. Clean Up Your Database

A bloated database slows queries, increasing TTFB. Cleaning removes overhead, spam, revisions, and transient options.

  1. Backup your database before making changes.
  2. Install a plugin like WP-Optimize or Advanced Database Cleaner.
  3. Run database optimization:
    • Remove post revisions
    • Delete spam and trashed comments
    • Clear expired transients
    • Optimize database tables
  4. Schedule regular cleanups to maintain performance.

4. Use a CDN

A Content Delivery Network (CDN) reduces latency by serving static files (images, CSS, JS) from servers closer to visitors.

  1. Choose a CDN provider (Cloudflare, BunnyCDN, StackPath, etc.).
  2. Create an account and configure your domain.
  3. Change your DNS nameservers to point to the CDN (if using Cloudflare) or configure your CDN to pull from your origin server.
  4. Install a plugin like Cloudflare or CDN Enabler to integrate the CDN with WordPress.
  5. Verify static assets load from the CDN URL.

Works on

Environment Notes
Apache Supports OPcache and object cache; .htaccess may be used for CDN rewrites.
Nginx Fully compatible with OPcache and object cache; CDN integration via proxy or DNS.
LiteSpeed Supports OPcache and object cache; LiteSpeed Cache plugin can help.
cPanel Enable OPcache via MultiPHP INI Editor; Redis/Memcached often available.
Plesk Enable OPcache via PHP settings; Redis/Memcached extensions can be installed.

FAQ

Q: How do I know if OPcache is working?
A: Use a phpinfo() page or a plugin like Query Monitor to check if OPcache is enabled and caching scripts.
Q: Can I enable object caching without Redis or Memcached?
A: Yes, but it’s less efficient. Some plugins offer file-based caching, but memory-based caches like Redis/Memcached are faster.
Q: Will enabling OPcache and object cache fix all performance issues?
A: They significantly reduce TTFB but don’t replace good hosting or optimized themes/plugins. Combine with database cleanup and CDN for best results.
Q: Is it safe to clean my database with plugins?
A: Yes, if you backup first. Use reputable plugins and avoid deleting data you might need.
Q: Does using a CDN increase my hosting costs?
A: Most CDNs have free tiers or low-cost plans. They
…
Speed & Security

BunnyCDN + Cloudflare: should you double‑up and how to do it

Posted on August 19, 2025 By Admin No Comments on BunnyCDN + Cloudflare: should you double‑up and how to do it

BunnyCDN + Cloudflare: Should You Double‑Up and How to Do It

Using BunnyCDN and Cloudflare together can supercharge your WordPress site’s speed and security. But is it necessary to stack these two CDNs, and if so, how do you configure them correctly without causing conflicts? This guide explains when combining BunnyCDN and Cloudflare makes sense and provides a clear, step-by-step setup to get you started.

Quick Fix: How to Use BunnyCDN and Cloudflare Together on WordPress

  1. Set up Cloudflare as your DNS and primary CDN with your domain pointing to your origin server.
  2. Create a Pull Zone in BunnyCDN targeting your Cloudflare URL or origin server.
  3. Configure BunnyCDN as a secondary CDN by rewriting static asset URLs to BunnyCDN URLs in WordPress.
  4. Adjust cache settings on both BunnyCDN and Cloudflare to avoid cache conflicts.
  5. Test your site to ensure assets load correctly and caching behaves as expected.

Why This Happens: Understanding the Need for BunnyCDN and Cloudflare Together

Cloudflare is a popular CDN and security provider that offers global caching, DDoS protection, and SSL termination. BunnyCDN is a fast, affordable CDN focused on delivering static assets with low latency. Using both together can:

  • Improve global performance: Cloudflare caches your entire site at the edge, while BunnyCDN can serve static assets from a highly optimized network.
  • Enhance security: Cloudflare protects your origin from attacks and bots.
  • Optimize costs: BunnyCDN’s pay-as-you-go pricing for bandwidth can reduce costs for heavy static asset delivery.

However, stacking two CDNs can cause caching conflicts, increased complexity, and potential delays if not configured properly. This is why a clear architecture and cache strategy is essential.

Architecture Options: How to Combine BunnyCDN and Cloudflare

There are two common architectures when combining BunnyCDN and Cloudflare:

Architecture Description Pros Cons
Cloudflare as Primary CDN + BunnyCDN as Secondary CDN Cloudflare proxies all traffic, BunnyCDN serves static assets (images, CSS, JS) via rewritten URLs. Best security, flexible static asset delivery, easy to control cache separately. Requires URL rewriting and cache rule management.
BunnyCDN as Primary CDN + Cloudflare as DNS + Security BunnyCDN pulls from origin; Cloudflare handles DNS and security but does not proxy content. Simpler CDN setup, Cloudflare security benefits. Less caching at Cloudflare edge, possible slower dynamic content.

The most common and recommended setup is Cloudflare as primary CDN with BunnyCDN serving static assets separately.

Step-by-Step: Setting Up BunnyCDN and Cloudflare Together on WordPress

  1. Configure Cloudflare for Your Domain
    1. Sign up or log in to Cloudflare.
    2. Add your domain and update your nameservers to Cloudflare’s.
    3. Enable proxy (orange cloud) for your domain in DNS settings.
    4. Configure SSL (Full or Full Strict) and security settings.
    5. Enable caching and performance features as needed.
    
  2. Create a BunnyCDN Pull Zone
    1. Log in to BunnyCDN dashboard.
    2. Go to 'Pull Zones' and create a new zone.
    3. Set the origin URL to your Cloudflare proxied domain (e.g., https://www.yoursite.com).
    4. Choose the closest storage region.
    5. Save the Pull Zone and note the BunnyCDN URL (e.g., yourzone.b-cdn.net).
    
  3. Rewrite Static Asset URLs in WordPress

    Use a plugin or code snippet to rewrite URLs for images, CSS, and JS to BunnyCDN URLs.

    <?php
    function replace_static_urls_with_bunnycdn($content) {
        $bunnycdn_url = 'https://yourzone.b-cdn.net';
        $site_url = get_site_url();
        $content = str_replace($site_url . '/wp-content/uploads', $bunnycdn_url . '/wp-content/uploads', $content);
        $content = str_replace($site_url . '/wp-includes', $bunnycdn_url . '/wp-includes', $content);
        $content = str_replace($site_url . '/wp-content/themes', $bunnycdn_url . '/wp-content/themes', $content);
        return $content;
    }
    add_filter('the_content', 'replace_static_urls_with_bunnycdn');
    add_filter('style_loader_src', function($src) use ($bunnycdn_url, $site_url) {
        return str_replace($site_url, $bunnycdn_url, $src);
    });
    add_filter('script_loader_src', function($src) use ($bunnycdn_url, $site_url) {
        return str_replace($site_url, $bunnycdn_url, $src);
    });
    ?>
    

    Alternatively, use plugins like CDN Enabler to rewrite URLs easily.

  4. Configure Cache Settings on Cloudflare and BunnyCDN
    • On Cloudflare, set caching level to “Standard” or “Aggressive” but exclude static assets served by BunnyCDN if possible.
    • On BunnyCDN, set appropriate cache expiration headers (e.g., 1 week for images, CSS, JS).
    • Use page rules in Cloudflare to bypass cache for dynamic content or admin pages.
  5. Test Your Setup
    1. Clear all caches (WordPress, BunnyCDN, Cloudflare).
    2. Load your site and inspect asset URLs to confirm they use BunnyCDN URLs.
    3. Use browser dev tools to check response headers for caching.
    4. Verify SSL works correctly and site loads fast globally.
    

Cache Rules: Best Practices for BunnyCDN and Cloudflare

  • Cloudflare: Use page rules to bypass cache on wp-admin, login pages, and dynamic endpoints.
  • BunnyCDN: Cache static assets aggressively with long TTL
…
Speed & Security

WP Rocket best settings on LiteSpeed servers (or use LSCache?)

Posted on August 19, 2025 By Admin No Comments on WP Rocket best settings on LiteSpeed servers (or use LSCache?)

WP Rocket Best Settings on LiteSpeed Servers (or Use LSCache?)

If you are running a WordPress site on a LiteSpeed server, you might wonder whether to use WP Rocket or LiteSpeed’s native LSCache plugin for optimal performance. Both plugins offer powerful caching and optimization features, but choosing the right one and configuring it correctly can significantly impact your site speed and resource usage.

This guide explains the best WP Rocket settings for LiteSpeed servers, compares WP Rocket with LSCache, and provides a settings checklist and benchmarks to help you decide which solution fits your needs.

Quick Fix: Best WP Rocket Settings on LiteSpeed Servers

  1. Enable WP Rocket’s caching but disable the “Minify CSS/JS” and “Combine CSS/JS” options to avoid conflicts with LiteSpeed server-level optimizations.
  2. Turn off WP Rocket’s lazy loading if LSCache is also active, or use only one plugin to avoid duplicate lazy loading.
  3. Disable WP Rocket’s database optimization if you use LSCache’s database cleaner.
  4. Use WP Rocket’s CDN integration if you have a CDN configured, but avoid overlapping CDN features with LSCache.
  5. Enable “Optimize CSS delivery” but test thoroughly as LiteSpeed may already optimize CSS loading.
  6. Exclude critical LSCache files from WP Rocket optimization to prevent conflicts.

When to Prefer WP Rocket vs LSCache

Use Case WP Rocket LSCache
Server Type Works on any server (Apache, Nginx, LiteSpeed) Only works on LiteSpeed servers
Ease of Use User-friendly UI, beginner-friendly More technical, requires LiteSpeed server
Performance Excellent caching and optimization Better integration with LiteSpeed server, faster cache delivery
Features Advanced minification, CDN, database cleanup, lazy load Server-level caching, ESI, HTTP/3 push, image optimization
Cost Premium plugin with subscription Free with LiteSpeed server

Summary: If you run a LiteSpeed server and want the best performance with server-level caching, LSCache is generally the preferred choice. However, if you want a simpler interface or use multiple server types, WP Rocket is a solid option with proper configuration.

Settings Checklist for WP Rocket on LiteSpeed Servers

  • Caching: Enable page caching but disable minify and combine CSS/JS.
  • File Optimization: Disable minify/combine CSS and JS to avoid conflicts.
  • Media: Enable lazy loading only if LSCache lazy loading is off.
  • Preload: Enable sitemap-based preload for faster cache warming.
  • Database: Disable database cleanup if LSCache database cleaner is active.
  • CDN: Configure CDN URL if applicable, avoid duplicate CDN features.
  • Advanced Rules: Exclude LSCache plugin files and cache folders from WP Rocket optimization.
  • Heartbeat Control: Use WP Rocket’s heartbeat control to reduce server load.

Benchmarks: WP Rocket vs LSCache on LiteSpeed Servers

Multiple independent tests show that LSCache outperforms WP Rocket on LiteSpeed servers in raw speed and server resource usage due to its server-level integration. Here are typical results from a WordPress site on a LiteSpeed server:

Metric WP Rocket LSCache
Page Load Time (Desktop) 1.2 seconds 0.8 seconds
Time to First Byte (TTFB) 250 ms 120 ms
CPU Usage (Peak) Moderate Low
Memory Usage Higher Lower

While WP Rocket is very effective, LSCache’s server-level caching and HTTP/3 push features give it an edge on LiteSpeed servers.

Why This Happens

WP Rocket is a PHP-level caching and optimization plugin designed to work across all server types. It generates cached HTML files and optimizes assets via PHP processes.

LSCache, on the other hand, integrates directly with the LiteSpeed web server, allowing it to serve cached pages faster without invoking PHP. It also supports advanced features like Edge Side Includes (ESI), HTTP/3 push, and image optimization at the server level.

This deep integration means LSCache can deliver faster response times and use fewer server resources compared to WP Rocket on LiteSpeed servers.

Step-by-Step: Configure WP Rocket on LiteSpeed Servers

  1. Install and activate WP Rocket from your WordPress dashboard.
  2. Go to Settings > WP Rocket > Cache and enable caching for mobile and logged-in users if needed.
  3. Navigate to Settings > WP Rocket > File Optimization and disable the following options:
    • Minify CSS files
    • Combine CSS files
    • Minify JavaScript files
    • Combine JavaScript files
  4. Under Media, enable lazy loading only if LSCache lazy loading is disabled or LSCache is not installed.
  5. Go to Preload and enable sitemap-based preloading by entering your sitemap URL.
  6. In Database, disable automatic cleanup if you use LSCache’s database cleaner.
  7. Under CDN, enter your CDN
…
Speed & Security

WP Rocket vs LiteSpeed Cache (which to use on your host?)

Posted on August 18, 2025August 19, 2025 By Admin No Comments on WP Rocket vs LiteSpeed Cache (which to use on your host?)

WP Rocket vs LiteSpeed Cache (Which to Use on Your Host?)

If you run a WordPress website, optimizing your site’s speed is crucial. Two of the most popular caching plugins are WP Rocket and LiteSpeed Cache. But which one should you use on your hosting environment? This article compares WP Rocket vs LiteSpeed Cache to help you decide quickly and set up the right caching solution for your site.

Quick Answer

  1. If your host uses LiteSpeed Web Server or OpenLiteSpeed, LiteSpeed Cache is the best choice because it integrates deeply with the server for superior performance.
  2. If your host uses Apache, Nginx, or any other web server, WP Rocket is a more universal and user-friendly option with excellent caching and optimization features.
  3. Both plugins offer page caching, minification, and optimization features, but LiteSpeed Cache requires LiteSpeed server to unlock its full potential.

When to Use Which

Scenario Recommended Plugin Reason
Hosting with LiteSpeed Web Server or OpenLiteSpeed LiteSpeed Cache Direct integration with server-level cache and QUIC.cloud CDN for best speed
Hosting with Apache, Nginx, or other servers WP Rocket Works universally with all servers and offers easy setup and advanced optimization
Need simple, beginner-friendly caching WP Rocket Intuitive UI and minimal configuration needed
Want advanced optimization features and server-level caching LiteSpeed Cache Includes image optimization, database cleanup, and server cache
Budget constraints (free plugin) LiteSpeed Cache Completely free with powerful features, WP Rocket is paid

Benchmarks

Benchmarks vary depending on hosting environment, site setup, and traffic. However, here are typical results from independent tests:

  • LiteSpeed Cache on LiteSpeed server: Can reduce page load times by up to 70% due to server-level caching and HTTP/3 support.
  • WP Rocket on Apache/Nginx: Improves load times by 40-60% with page caching, lazy loading, and file optimization.
  • Both plugins significantly improve Google PageSpeed Insights and GTmetrix scores.

Note: LiteSpeed Cache’s performance advantage depends heavily on the LiteSpeed server environment.

Setup Checklist

  1. Check your web server: Identify if your hosting uses LiteSpeed, Apache, or Nginx.
  2. Install the appropriate plugin:
    • For LiteSpeed server: Install LiteSpeed Cache plugin from the WordPress repository.
    • For Apache/Nginx: Purchase and install WP Rocket from their official site.
  3. Configure basic caching:
    // WP Rocket
    // Enable caching and file optimization from the WP Rocket dashboard.
    
    // LiteSpeed Cache
    // Enable Cache and Object Cache in LiteSpeed Cache settings.
    
  4. Enable minification and concatenation:
    // WP Rocket
    // Activate CSS, JS minification and combine files in WP Rocket settings.
    
    // LiteSpeed Cache
    // Enable CSS/JS Minify and Combine options in LiteSpeed Cache Page Optimization.
    
  5. Set up lazy loading for images:
    // WP Rocket
    // Enable LazyLoad for images and iframes in Media settings.
    
    // LiteSpeed Cache
    // Enable Lazy Load Images and iframes in Media settings.
    
  6. Configure CDN (optional):
    • WP Rocket supports most CDNs via URL configuration.
    • LiteSpeed Cache integrates with QUIC.cloud CDN for image optimization and HTTP/3 support.
  7. Test your site speed: Use tools like Google PageSpeed Insights, GTmetrix, or WebPageTest to verify improvements.

Why This Happens

WP Rocket and LiteSpeed Cache approach caching differently due to their server dependencies:

  • WP Rocket is a PHP-based caching plugin that works on any server by generating static HTML files and optimizing assets. It is easy to use but limited to application-level caching.
  • LiteSpeed Cache leverages LiteSpeed Web Server’s built-in caching engine, which operates at the server level, offering faster cache retrieval and advanced features like HTTP/3 and QUIC support.

Therefore, LiteSpeed Cache outperforms WP Rocket only if your host runs LiteSpeed server. Otherwise, WP Rocket is the safer, more compatible choice.

Works On

Plugin Web Servers Supported Hosting Panels
WP Rocket Apache, Nginx, LiteSpeed, others cPanel, Plesk, DirectAdmin, others
LiteSpeed Cache LiteSpeed Web Server, OpenLiteSpeed only cPanel, Plesk, DirectAdmin (if LiteSpeed installed)

FAQ

  1. Can I use both WP Rocket and LiteSpeed Cache together?

    No. Using both simultaneously can cause conflicts. Use only the plugin that matches your server environment.

  2. Is LiteSpeed Cache free?

    Yes, LiteSpeed Cache is completely free and offers many premium features without cost.

  3. Does WP Rocket work on LiteSpeed servers?

    Yes, WP Rocket works on LiteSpeed servers but

…
Comparisons

Recent Posts

  • Top WordPress Themes for Blogs in 2025
  • WordPress Admin Panel Trick: Adding ID Field to the Posts Listing
  • Solution previous_posts_link and next_posts_link Not Working
  • Show Top Commentators in WordPress Without a Plugin
  • How to Style Admin Comments in WordPress

Recent Comments

    Archives

    • August 2025

    Categories

    • Admin & Blocks
    • Admin & UI
    • Automation
    • Automation & Plugins
    • Comments
    • Comparisons
    • Database & Revisions
    • Developer Snippets
    • Fixes & Errors
    • Media & Thumbnails
    • Queries & Pagination
    • Security
    • Speed & Security
    • Tips & Tricks
    • WooCommerce How‑tos
    • WordPress Snippets
    • WordPress Themes
    • Terms & Conditions
    • Affiliate Disclosure

    Copyright © 2025 wpcanyon.com.

    Powered by PressBook WordPress theme

    Also by the maker of MySurveyReviews.com