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 );
SWIS_CACHE_EXPIRES (in hours)
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.
define( 'SWIS_CACHE_UPDATE_PRODUCT_STOCK', true );
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_CACHE_PRELOAD', true );
To exlude files from preloading, use the swis_skip_cache_preload filter to skip selected pages. The first argument defaults to false, return true to skip the given page. The second argument is the page URL.
SWIS_CACHE_PRELOAD_DELAY - by default, SWIS will wait 5 seconds between requests in order to avoid a server overload. You may with to have it go faster if your server has sufficient resources. Alternatively, you may use the 'swis_cache_preload_delay' filter.
define( 'SWIS_CACHE_PRELOAD_DELAY', 2 );
SWIS_CACHE_PRELOAD_SITEMAP - specify your own sitemap(s) to use for preloading. By default, SWIS looks for sitemap_index.xml, sitemap.xml, and wp-sitemap.xml. But if you have a sitemap located elsewhere, you can tell SWIS to use that instead. You can provide either a single URL, or an array of sitemap URLs. Alternatively, use the swis_cache_preload_default_sitemaps filter.
define( 'SWIS_CACHE_PRELOAD_SITEMAP', 'https://example.com/my-sitemap.xml' );
SWIS_CACHE_PRELOAD_FRONT_PAGE_AUTO - when the preloader is used with our cache, everything is automatic. But if you are using a third-party/server-based page cache, this option will trigger the preload process any time an uncached home/front page is encountered. Use with caution, as short cache lifetimes will cause the preloader to run constantly.
define( 'SWIS_CACHE_PRELOAD_FRONT_PAGE_AUTO', true );
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.
define( 'SWIS_SLIM_DISABLE_FRONTEND_MENU', true );