SWIS Overrides

There are a handful of settings not yet available in the UI. Additionally, if you would like to use SWIS on multi-site, you'll notice there isn't a network-wide settings page. That's on purpose, because overrides let you set network-wide defaults, but only for the settings you want. If you prefer to configure certain settings per-site, you can do that just fine. No need for any complicated logic. Anything that you don't define in your wp-config.php will be configurable on the single-site settings.

Let's see an example of how this works. To override anything within SWIS Performance, you define a "constant" in your wp-config.php file. This is the file where your database connection details are stored, as well as a few other settings that are global within WordPress. The wp-config.php file is located right in the root of your WordPress install folder, often right inside the public_html folder or a similar location.

Defining a constant looks something like this:

define( 'SWIS_CACHE_EXPIRES', 24 );

Important: For all overrides, make sure that you insert the define above where your wp-config.php file says to stop editing. You'll see something like "That's all, stop editing!". Adding anything below that line will not have any effect. Also, make sure you do not use quotes around boolean (true/false) and numerical values or this will turn them into strings, like 'something', 'false', or '8'.

Here are all the available overrides (with examples):


define( 'SWIS_DEBUG', true );


define( 'SWIS_CACHE', true );


define( 'SWIS_CACHE_EXPIRES', 24 );

SWIS_CACHE_CLEAR_ON_UPGRADE - enabled by default, and clears the whole cache when a theme, plugin, or core upgrade is completed.

define( 'SWIS_CACHE_CLEAR_ON_UPGRADE', false );

SWIS_CACHE_NEW_POST - disabled by default, and clears the whole cache when a post/page is published instead of just the home page and individual page.

define( 'SWIS_CACHE_NEW_POST', true );

SWIS_CACHE_NEW_COMMENT - disabled by default, and clears the whole cache when a comment is added, deleted, updated, etc. instead of just the individual page where the comment was written.

define( 'SWIS_CACHE_NEW_COMMENT', true );

SWIS_CACHE_UPDATE_PRODUCT_STOCK - disabled by default, and clears the whole cache when WooCommerce stock is updated instead of just the individual product page.


SWIS_CACHE_WEBP - disabled by default, and generates separate cache files for browsers that support WebP images. Only works for standard "img" elements currently.

define( 'SWIS_CACHE_WEBP', false );


define( 'SWIS_CACHE_EXCLUSIONS', array( '/thing1/', '/thing2/' ) );

SWIS_CACHE_EXCL_COOKIES - this must be a valid regex, the default is shown below. Any visitor that has a matching cookie will bypass the cache.

define( 'SWIS_CACHE_EXCL_COOKIES', '/^(wp-postpass|wordpress_logged_in|comment_author|woocommerce_items_in_cart|wp_woocommerce_session)/' );

SWIS_CACHE_INCL_PARAMETERS - this must be a valid regex, the default is shown below. A whitelist of allowed GET/query parameters for caching. If a URL contains parameters NOT in this list, it will bypass the cache.

define( 'SWIS_CACHE_INCL_PARAMETERS', '/^fbclid|utm_(source|medium|campaign|term|content)$/' );


define( 'SWIS_LAZY_LOAD', true );


define( 'SWIS_DEFER_CSS', true );


define( 'SWIS_MINIFY_CSS', true );


define( 'SWIS_DEFER_JS', true );


define( 'SWIS_MINIFY_JS', true );


define( 'SWIS_OPTIMIZE_FONTS', true );

SWIS_SLIM_DISABLE_FRONTEND_MENU - The SLIM module adds information to each page when so you can see what JS/CSS files are loading as a logged-in admin. But if you need to suppress the HTML and front-end functions from the SLIM module, you may do so with this override.