Support

Find answers, guides, and tutorials to supercharge your content delivery.

WordPress Cache Enabler Plugin

Updated on February 10, 2021

The WordPress Cache Enabler plugin is a lightweight page caching plugin that creates static HTML files and stores them on your web server. This means that a static HTML file will be delivered whenever possible to provide users with the response data that would otherwise involve the resource intensive process of using the WordPress core, plugins, and database. It supports converting inline image URLs to WebP and pre-compressing cached pages with Gzip. This simple, yet powerful plugin is easy to use, needs minimal configuration, and best of all helps improve site load time.

Installation

Installation of the WordPress Cache Enabler plugin is easy and can be done in just a few steps:

  1. Log in to your WordPress admin dashboard.
  2. In the left navigation sidebar hover over Plugins and then click Add New.
  3. Either upload the latest Cache Enabler version in .zip format, which can be directly downloaded here, or search for “Cache Enabler” and click Install Now on the plugin by KeyCDN.
  4. After the Cache Enabler plugin has been installed activate the plugin.

Cache Enabler will now be successfully installed and activated on your WordPress website. We have built this plugin to work for the majority of WordPress installations right out of the box, which means there are no required configurations or settings to make this plugin start caching your pages. However, you may want to further configure Cache Enabler to fit your needs, which can be done through the plugin settings and/or hooks.

Settings

Customizing the Cache Enabler plugin settings can be done by going to the Cache Enabler settings page. This page can be accessed by doing the following:

  1. Log in to your WordPress admin dashboard.
  2. In the left navigation sidebar hover over Settings and then click Cache Enabler.

The Cache Enabler settings page is simple and broken into two parts, Cache Behavior and Cache Exclusions. The Cache Behavior settings control the behavior of page caching, whereas the Cache Exclusions settings controls what pages should bypass the cache.

Hooks

NameTypeDescription
cache_enabler_clear_complete_cacheActionClear the complete cache.
cache_enabler_complete_cache_clearedActionFires after the complete cache has been cleared.
cache_enabler_clear_site_cacheActionClear the site cache for the current blog ID.
cache_enabler_clear_site_cache_by_blog_idActionClear the site cache for the given blog ID.
cache_enabler_site_cache_clearedActionFires after the site cache has been cleared.
cache_enabler_clear_page_cache_by_post_idActionClear the page cache for the given post ID.
cache_enabler_clear_page_cache_by_urlActionClear the page cache for the given URL.
cache_enabler_page_cache_clearedActionFires after the page cache has been cleared.
cache_enabler_user_can_clear_cacheFilterFilters whether the current user can clear the cache.
cache_enabler_exclude_searchFilterFilters whether search queries should bypass the cache
cache_enabler_bypass_cacheFilterFilters whether the cache should be bypassed.
cache_enabler_page_contents_before_storeFilterFilters page contents before being stored.
cache_enabler_minify_html_ignore_tagsFilterFilters HTML tags to ignore during minification.
cache_enabler_convert_webp_attributesFilterFilters HTML attributes to convert during WebP conversion.
cache_enabler_convert_webp_ignore_query_stringsFilterFilters whether inline image URLs with query strings should be ignored during WebP conversion.
cache_enabler_page_contents_after_webp_conversionFilterFilters page contents after inline image URLs were maybe converted to WebP.

cache_enabler_clear_complete_cache

do_action( 'cache_enabler_clear_complete_cache' );

Clear the complete cache.

Source

File: inc/cache_enabler.class.php

Changelog

1.6.0 - Introduced

Example

function clear_cache_enabler_complete_cache() {

    do_action( 'cache_enabler_clear_complete_cache' );
}

cache_enabler_complete_cache_cleared

do_action( 'cache_enabler_complete_cache_cleared' );

Fires after the complete cache has been cleared.

Source

File: inc/cache_enabler_disk.class.php

Changelog

1.6.0 - Introduced

Example

add_action( 'cache_enabler_complete_cache_cleared', 'on_cache_enabler_complete_cache_cleared' );

function on_cache_enabler_complete_cache_cleared() {

    // code...
}

cache_enabler_clear_site_cache

do_action( 'cache_enabler_clear_site_cache' );

Clear the site cache for the current blog ID.

Source

File: inc/cache_enabler.class.php

Changelog

1.6.0 - Introduced

Example

function clear_cache_enabler_site_cache() {

    do_action( 'cache_enabler_clear_site_cache' );
}

cache_enabler_clear_site_cache_by_blog_id

do_action( 'cache_enabler_clear_site_cache_by_blog_id', integer $blog_id );

Clear the site cache for the given blog ID.

Parameters

$blog_id (integer) Blog ID of site cache to clear.

Source

File: inc/cache_enabler.class.php

Changelog

1.6.0 - Introduced

Example

$blog_id = 1;

function clear_cache_enabler_site_cache_by_blog_id( $blog_id ) {

    do_action( 'cache_enabler_clear_site_cache_by_blog_id', $blog_id );
}

cache_enabler_site_cache_cleared

do_action( 'cache_enabler_site_cache_cleared', string $site_cleared_url, integer $site_cleared_id );

Fires after the site cache has been cleared.

Parameters

$site_cleared_url (string) Full URL of site cleared.

$site_cleared_id (integer) Blog ID of site cleared.

Source

File: inc/cache_enabler_disk.class.php

Changelog

1.6.0 - Introduced

Example

add_action( 'cache_enabler_site_cache_cleared', 'on_cache_enabler_site_cache_cleared', 10, 2 );

function on_cache_enabler_site_cache_cleared( $site_cleared_url, $site_cleared_id ) {

    // code...
}

cache_enabler_clear_page_cache_by_post_id

do_action( 'cache_enabler_clear_page_cache_by_post_id', integer $post_id );

Clear the page cache for the given post ID.

Parameters

$post_id (integer) Post ID of page cache to clear.

Source

File: inc/cache_enabler.class.php

Changelog

1.6.0 - Introduced

Example

$post_id = 1;

function clear_cache_enabler_page_cache_by_post_id( $post_id ) {

    do_action( 'cache_enabler_clear_page_cache_by_post_id', $post_id );
}

cache_enabler_clear_page_cache_by_url

do_action( 'cache_enabler_clear_page_cache_by_url', string $clear_url );

Clear the page cache for the given URL.

Parameters

$clear_url (string) Full URL of page cache to clear.

Source

File: inc/cache_enabler.class.php

Changelog

1.6.0 - Introduced

Example

$clear_url = 'https://www.example.com/about-us/';

function clear_cache_enabler_page_cache_by_url( $clear_url ) {

    do_action( 'cache_enabler_clear_page_cache_by_url', $clear_url );
}

cache_enabler_page_cache_cleared

do_action( 'cache_enabler_page_cache_cleared', string $page_cleared_url, integer $page_cleared_id );

Fires after the page cache has been cleared.

Parameters

$page_cleared_url (string) Full URL of page cleared.

$page_cleared_id (integer) Post ID of page cleared.

Source

File: inc/cache_enabler_disk.class.php

Changelog

1.6.0 - Introduced

Example

add_action( 'cache_enabler_page_cache_cleared', 'on_cache_enabler_page_cache_cleared', 10, 2 );

function on_cache_enabler_page_cache_cleared( $page_cleared_url, $page_cleared_id ) {

    // code...
}

cache_enabler_user_can_clear_cache

apply_filters( 'cache_enabler_user_can_clear_cache', current_user_can( 'manage_options' ) );

Filters whether the current user can clear the cache.

Source

File: inc/cache_enabler.class.php

Changelog

1.6.0 - Introduced

Example

add_filter( 'cache_enabler_user_can_clear_cache', 'current_user_can_edit_posts' );

function current_user_can_edit_posts() {

    return current_user_can( 'edit_posts' );
}

apply_filters( 'cache_enabler_exclude_search', is_search() );

Filters whether search queries should bypass the cache.

Source

File: inc/cache_enabler_engine.class.php

Changelog

1.6.0 - Introduced

Example

add_filter( 'cache_enabler_exclude_search', '__return_false' );

cache_enabler_bypass_cache

apply_filters( 'cache_enabler_bypass_cache', false );

Filters whether the cache should be bypassed.

Source

File: inc/cache_enabler_engine.class.php

Changelog

1.6.0 - Introduced

Example

add_filter( 'cache_enabler_bypass_cache', '__return_true' );

cache_enabler_page_contents_before_store

apply_filters( 'cache_enabler_page_contents_before_store', string $page_contents );

Filters page contents before being stored.

Parameters

$page_contents (string) Page contents from the output buffer as raw HTML.

Source

File: inc/cache_enabler_disk.class.php

Changelog

1.6.0 - Introduced

Example

add_filter( 'cache_enabler_page_contents_before_store', 'filter_cache_enabler_page_contents_before_store' );

function filter_cache_enabler_page_contents_before_store( $page_contents ) {

    // code...
}

cache_enabler_minify_html_ignore_tags

apply_filters( 'cache_enabler_minify_html_ignore_tags', array $ignore_tags );

Filters HTML tags to ignore during minification.

Parameters

$ignore_tags (array) HTML tags without leading < or trailing >. Default tags ignored are textarea, pre, code.

Source

File: inc/cache_enabler_disk.class.php

Changelog

1.6.0 - Introduced

Example

add_filter( 'cache_enabler_minify_html_ignore_tags', 'filter_cache_enabler_minify_html_ignore_tags' );

function filter_cache_enabler_minify_html_ignore_tags( $ignore_tags ) {

    $ignore_tags[] = 'canvas'; // also ignore the HTML <canvas> element

    return $ignore_tags;
}

cache_enabler_convert_webp_attributes

apply_filters( 'cache_enabler_convert_webp_attributes', array $attributes );

Filters HTML attributes to convert during WebP conversion.

Parameters

$attributes (array) HTML attributes. Default attributes converted are src, srcset, and data-*.

Source

File: inc/cache_enabler_disk.class.php

Changelog

1.6.1 - Introduced

Example

add_filter( 'cache_enabler_convert_webp_attributes', 'filter_cache_enabler_convert_webp_attributes' );

function filter_cache_enabler_convert_webp_attributes( $attributes ) {

    $attributes[] = 'href'; // also convert href attributes

    return $attributes;
}

cache_enabler_convert_webp_ignore_query_strings

apply_filters( 'cache_enabler_convert_webp_ignore_query_strings', true );

Filters whether inline image URLs with query strings should be ignored during WebP conversion.

Source

File: inc/cache_enabler_disk.class.php

Changelog

1.6.1 - Introduced

Example

add_filter( 'cache_enabler_convert_webp_ignore_query_strings', '__return_false' );

cache_enabler_page_contents_after_webp_conversion

apply_filters( 'cache_enabler_page_contents_after_webp_conversion', string $page_contents );

Filters page contents after inline image URLs were maybe converted to WebP.

Parameters

$page_contents (string) Page contents from the output buffer as raw HTML.

Source

File: inc/cache_enabler_disk.class.php

Changelog

1.6.0 - Introduced

Example

add_filter( 'cache_enabler_page_contents_after_webp_conversion', 'filter_cache_enabler_page_contents_after_webp_conversion' );

function filter_cache_enabler_page_contents_after_webp_conversion( $page_contents ) {

    // code...
}

WP-CLI

Interact with Cache Enabler from the command line by either clearing the cache or updating the settings. This can be done through WP-CLI with the cache-enabler and option commands.

cache-enabler

Clear the cache with the cache-enabler command and clear subcommand.

Options

--ids=<id>
Clear the cache for given post ID(s). Separate multiple IDs with commas.

--urls=<url>
Clear the cache for the given URL(s). Separate multiple URLs with commas.

--sites=<site>
Clear the cache for the given blog ID(s). Separate multiple blog IDs with commas.

Examples

# Clear all pages cache.
$ wp cache-enabler clear

# Clear the page cache for post IDs 1, 2, and 3.
$ wp cache-enabler clear --ids=1,2,3

# Clear the page cache for a particular URL.
$ wp cache-enabler clear --urls=https://www.example.com/about-us/

# Clear all pages cache for sites with blog IDs 1, 2, and 3.
$ wp cache-enabler clear --sites=1,2,3

option

Update the settings with the option command and update subcommand.

ParameterDescriptionValue
versionPlugin version.string
permalink_structureWhether or not permalink structure has trailing slash.has_trailing_slash, no_trailing_slash, or plain
string
cache_expiresWhether or not cached pages expire.0 or 1
integer
cache_expiry_timeCache expiry measured in hours.0 or 1
integer
clear_site_cache_on_saved_postClear the site cache if any post type has been published, updated, or trashed (instead of only the page and/or associated cache).0 or 1
integer
clear_site_cache_on_saved_commentClear the site cache if a comment has been posted, updated, spammed, or trashed (instead of only the page cache).0 or 1
integer
clear_site_cache_on_changed_pluginClear the site cache if a plugin has been activated, updated, or deactivated.0 or 1
integer
convert_image_urls_to_webpCreate an additional cached version for WebP image support. Convert your images to WebP with Optimus.0 or 1
integer
compress_cachePre-compress cached pages with Gzip.0 or 1
integer
minify_htmlMinify HTML in cached pages.0 or 1
integer
minify_inline_css_jsMinify inline CSS and JavaScript when minifying HTML.0 or 1
integer
excluded_post_idsPost IDs separated by a , that should bypass the cache.string
excluded_page_pathsA regex matching page paths that should bypass the cache.string
excluded_query_stringsA regex matching query strings that should bypass the cache.string
excluded_cookiesA regex matching cookies that should bypass the cache.string

Example

# Enable WebP and Gzip variants with full HTML minification.
$ wp option update cache_enabler \
'{
    "version": "1.6.2",
    "permalink_structure": "has_trailing_slash",
    "cache_expires": 0,
    "cache_expiry_time": 0,
    "clear_site_cache_on_saved_post": 0,
    "clear_site_cache_on_saved_comment": 0,
    "clear_site_cache_on_changed_plugin": 0,
    "convert_image_urls_to_webp": 1,
    "compress_cache": 1,
    "minify_html": 1,
    "minify_inline_css_js": 1,
    "excluded_post_ids": "",
    "excluded_page_paths": "",
    "excluded_query_strings": "",
    "excluded_cookies": ""
}' \
--format=json

Advanced configuration

A more advanced configuration can be implemented to bypass PHP entirely for even faster delivery of cached pages. The following configuration snippets can be implemented on Apache or Nginx servers. The advanced configuration snippets should only be used by those who are experienced in modifying server configuration files. Furthermore, the default Cache Enabler setup should satisfy the majority of use-cases.

Note: This configuration is optional and is not required in order to use the Cache Enabler plugin. It is only an optional configuration for those who want to entirely bypass PHP if a static HTML file exists. This configuration will not take into account the cached page expiration and some exclusion settings.

Apache

Add the following snippet before the # BEGIN WordPress section in your .htaccess file if you are using Apache 2.3.9 or later.

The snippet defines certain conditions and if they are met then the RewriteRule will be triggered. For the gzip version, the last condition, RewriteCond %{DOCUMENT_ROOT}%{ENV:SUB_PATH}%{HTTP_HOST}%{ENV:CE_PATH}%{REQUEST_SCHEME}-index.html.gz -f, checks to see if the HTML static file is available and if that condition, and all other conditions are met, a rewrite is triggered. The static HTML file is then directly fetched (preventing any PHP calls) and sent back to the client.

The SUB_PATH variable needs to be adjusted accordingly if you have installed WordPress in a subdirectory (e.g. http://www.example.com/blog requires a change to SUB_PATH=/blog/wp-content/cache/cache-enabler/).

Additionally, if you change the location of wp-admin, this must also be adjusted in the RewriteCond %{ENV:CE_PATH} !^/wp-admin/.* condition.

# BEGIN Cache Enabler advanced configuration
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    # set blog sub path
    SetEnvIf Request_URI "^(.*)$" SUB_PATH=/wp-content/cache/cache-enabler/

    # set Cache Enabler path
    SetEnvIf Request_URI "^(.*)$" CE_PATH=$1
    SetEnvIf Request_URI "^(/)index.php$" CE_PATH=$1

    <IfModule mod_mime.c>
        # WebP HTML file
        RewriteCond %{ENV:CE_PATH} /$
        RewriteCond %{ENV:CE_PATH} !^/wp-admin/.*
        RewriteCond %{REQUEST_METHOD} !=POST
        RewriteCond %{QUERY_STRING} =""
        RewriteCond %{HTTP_COOKIE} !(wp-postpass|wordpress_logged_in|comment_author)_
        RewriteCond %{HTTP:Accept-Encoding} gzip
        RewriteCond %{HTTP:Accept} image/webp
        RewriteCond %{DOCUMENT_ROOT}%{ENV:SUB_PATH}%{HTTP_HOST}%{ENV:CE_PATH}%{REQUEST_SCHEME}-index-webp.html.gz -f
        RewriteRule ^(.*) %{ENV:SUB_PATH}%{HTTP_HOST}%{ENV:CE_PATH}%{REQUEST_SCHEME}-index-webp.html.gz [L]

        # Gzip HTML file
        RewriteCond %{ENV:CE_PATH} /$
        RewriteCond %{ENV:CE_PATH} !^/wp-admin/.*
        RewriteCond %{REQUEST_METHOD} !=POST
        RewriteCond %{QUERY_STRING} =""
        RewriteCond %{HTTP_COOKIE} !(wp-postpass|wordpress_logged_in|comment_author)_
        RewriteCond %{HTTP:Accept-Encoding} gzip
        RewriteCond %{DOCUMENT_ROOT}%{ENV:SUB_PATH}%{HTTP_HOST}%{ENV:CE_PATH}%{REQUEST_SCHEME}-index.html.gz -f
        RewriteRule ^(.*) %{ENV:SUB_PATH}%{HTTP_HOST}%{ENV:CE_PATH}%{REQUEST_SCHEME}-index.html.gz [L]

        AddType text/html .gz
        AddEncoding gzip .gz
    </IfModule>

    # WebP HTML file
    RewriteCond %{ENV:CE_PATH} /$
    RewriteCond %{ENV:CE_PATH} !^/wp-admin/.*
    RewriteCond %{REQUEST_METHOD} !=POST
    RewriteCond %{QUERY_STRING} =""
    RewriteCond %{HTTP_COOKIE} !(wp-postpass|wordpress_logged_in|comment_author)_
    RewriteCond %{HTTP:Accept} image/webp
    RewriteCond %{DOCUMENT_ROOT}%{ENV:SUB_PATH}%{HTTP_HOST}%{ENV:CE_PATH}%{REQUEST_SCHEME}-index-webp.html -f
    RewriteRule ^(.*) %{ENV:SUB_PATH}%{HTTP_HOST}%{ENV:CE_PATH}%{REQUEST_SCHEME}-index-webp.html [L]

    # default HTML file
    RewriteCond %{ENV:CE_PATH} /$
    RewriteCond %{ENV:CE_PATH} !^/wp-admin/.*
    RewriteCond %{REQUEST_METHOD} !=POST
    RewriteCond %{QUERY_STRING} =""
    RewriteCond %{HTTP_COOKIE} !(wp-postpass|wordpress_logged_in|comment_author)_
    RewriteCond %{DOCUMENT_ROOT}%{ENV:SUB_PATH}%{HTTP_HOST}%{ENV:CE_PATH}%{REQUEST_SCHEME}-index.html -f
    RewriteRule ^(.*) %{ENV:SUB_PATH}%{HTTP_HOST}%{ENV:CE_PATH}%{REQUEST_SCHEME}-index.html [L]

    # WordPress override
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [END]
</IfModule>
# END Cache Enabler advanced configuration

Nginx

We recommend to use the gzip_static on; directive to directly deliver the Gzipped version of the static HTML file to the client. However, gzip_static is not required but you should have at least Gzip enabled gzip on; for best performance.

The $custom_subdir variable needs to be adjusted accordingly if you have installed WordPress in a subdirectory (e.g. http://www.example.com/blog).

server {
    set $cache_uri $request_uri;

    # bypass cache if POST requests or URLs with a query string
    if ($request_method = POST) {
        set $cache_uri 'nullcache';
    }

    if ($query_string != '') {
        set $cache_uri 'nullcache';
    }

    # bypass cache if URLs containing the following strings
    if ($request_uri ~* '(/wp-admin/|/xmlrpc.php|/wp-(app|cron|login|register|mail).php|wp-.*.php|/feed/|index.php|wp-comments-popup.php|wp-links-opml.php|wp-locations.php|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)') {
        set $cache_uri 'nullcache';
    }

    # bypass cache if cookies contain the following strings
    if ($http_cookie ~* '(wp-postpass|wordpress_logged_in|comment_author)_') {
        set $cache_uri 'nullcache';
    }

    # custom installation subdirectory
    set $custom_subdir '';

    # default HTML file
    set $cache_enabler_uri '${custom_subdir}/wp-content/cache/cache-enabler/${http_host}${cache_uri}${scheme}-index.html';

    # WebP HTML file
    if ($http_accept ~* 'image/webp') {
        set $cache_enabler_uri '${custom_subdir}/wp-content/cache/cache-enabler/${http_host}${cache_uri}${scheme}-index-webp.html';
    }

    location / {
        gzip_static on; # this directive is not required but recommended
        try_files $cache_enabler_uri $uri $uri/ $custom_subdir/index.php?$args;
    }

    ...
}

FAQ

Find answers to commonly asked questions about Cache Enabler. Still have questions? Open a new topic in the WordPress Support Forums and we would be happy to help.

How can I check if Cache Enabler is working on my site?

You can quickly verify that the Cache Enabler is delivering a cached version of a specific page by logging out of your WordPress installation and checking the bottom of your page source for the Cache Enabler HTML comment, for example:

<!-- Cache Enabler by KeyCDN @ 08.12.2020 17:32:29 (https webp gzip) -->

Alternatively, check the response headers of the HTML page for X-Cache-Handler: cache-enabler-engine if the advanced configuration is not used.

What is performed when Cache Enabler is activated?

Upon activation, Cache Enabler will first setup the backend by adding or updating the database. Next, it will copy the advanced-cache.php file from the wp-content/plugins/cache-enabler directory to the wp-content directory. Lastly, it will add the following snippet to the wp-config.php file if the WP_CACHE constant is not found and the config file is the default:

/** Enables page caching for Cache Enabler. */
if ( ! defined( 'WP_CACHE' ) ) {
    define( 'WP_CACHE', true );
}
Note: The wp-content/advanced-cache.php drop-in and having WP_CACHE constant defined as true are required for Cache Enabler to cache and deliver pages.

What is performed when Cache Enabler is deactivated?

Upon deactivation, Cache Enabler will first delete the advanced-cache.php file from the wp-content directory. Next, it will remove the snippet added by Cache Enabler in the wp-config.php file. Lastly, it will clear the complete cache.

What is performed when Cache Enabler is uninstalled?

Upon uninstallation, Cache Enabler will delete the single database option that was added during the initial plugin activation.

What happens when any post type is published, updated, or trashed?

By default, when any post type is published the associated cache will be cleared. When any post type is updated or trashed the page and associated cache will be cleared. The associated cache is any pages that are associated with the new or existing page, which could be the post type, taxonomy, author, or date archives page. This ensures pages that will contain the new page or pages that already contain an existing page are cleared.

The ability to clear the site cache instead is possible through the available Cache Enabler clearing setting.

Can I clear the cache of a specific page?

Yes. You can clear the cache of a specific page by going to that page and clicking the "Clear Page Cache" button in the WordPress admin bar.

How does the WebP cached variant work?

Cache Enabler parses the page contents and replaces inline image URLs with the WebP formatted image if it exists. This will work for images with the extension replaced, such as example.webp, or images with the extension appended, such as example.jpg.webp. This page is then cached separately and is delivered when accepted and the cached page with the default format(s) will be delivered when not.

How can I convert my images to WebP?

To convert your images to WebP, use the Cache Enabler plugin in conjunction with the Optimus image optimizer plugin.

How do I use Cache Enabler on a multisite network?

Using the Cache Enabler plugin on a multisite network is quite straightforward. Once the plugin is installed you can either network activate it and it will start working for each site in the network, or you can activate Cache Enabler on each site individually that you want it running on. The cache and settings are configured to work individually for each site. Therefore, you can clear the cache on site 1, while site 2 and 3 will retain their cache.

Network settings are not currently available but we intend on introducing this in future (#123).

No. Cache Enabler does not work with default permalinks.

Does Cache Enabler work with mobile themes if the desktop and mobile versions are different?

It is not currently recommended to use the Cache Enabler plugin if a mobile theme or plugin is used that shows different layouts for desktop and mobile. The cache is bypassed if any of these plugins are used:

  • WPtouch
  • Carrington
  • Jetpack
  • Handheld

Otherwise the cached version is delivered to the mobile user. However, we intend on improving this in the future by introducing mobile caching support (#160).

Will cached page expiration still work if the advanced configuration is used?

No. Cache Enabler's ability to automatically expire the cached page based on a defined period will no longer work as the PHP calls required for that function will be bypassed.

However, a cron job may be created in order to continue expiring the cache automatically. Add the following command to your cron job once you have determined the time period for which you would like the cache to expire:

*/1 * * * * rm -rf /path/to/your/wordpress/wp-content/cache/cache-enabler/

How can I verify if the advanced configuration is bypassing PHP?

By adding the advanced configuration snippet to your server you have the ability to bypass PHP in order to retrieve the static HTML file that was created by the WordPress Cache Enabler plugin. In order to ensure that you are in fact bypassing PHP after you've added the snippet, open up your developer tools, navigate to the Network panel and select the HTML file of your page.

If you've added the advanced configuration snippet successfully, the X-Cache-Handler: cache-enabler-engine response header will no longer be set, which means the Cache Enabler engine, which is powered by PHP, is no longer handling the delivery. If this response header is not present and the Cache Enabler HTML comment is still in the page source then your advanced configuration is properly implemented.

Supercharge your content delivery 🚀

Try KeyCDN with a free 14 day trial, no credit card required.

Get started
KeyCDN uses cookies to make its website easier to use. Learn more about cookies.