You can define various constants in wp-config.php to tweak settings, or enable hidden features.

Where should I add these code snippets?

In the root folder of WordPress install you will find a file named wp-config.php. This file contains the basic configuration for  WordPress. You can add the code snippets to this file, before the /* That’s all, stop editing! Happy publishing. */ line

Disable Caching

If you define SWIFT_PERFORMANCE_DISABLE_CACHE and set it to true in wp-config.php, Swift Performance will disable caching module. In some cases Swift Performance will disable caching automatically. If you would like to override this, you can define SWIFT_PERFORMANCE_DISABLE_CACHE and set it to false.

define(SWIFT_PERFORMANCE_DISABLE_CACHE, true);

Disable Whitelabel

If you enable Whitelabel and save settings, Whitelabel options will be hidden on the settings page. You can temporary disable Whitelabel if you add a constant to wp-config.php

define(SWIFT_PERFORMANCE_WHITELABEL, false);

Lazyload Size

If you are using blurred method for lazyload placeholders, Swift Performance will create a smaller version for all images. You can change the default 20x20px size with SWIFT_PERFORMANCE_LAZYLOAD_SIZE constant. After you change this you should regenerate thumbnails.

define(SWIFT_PERFORMANCE_LAZYLOAD_SIZE, 20);

Lazyload Quality

If you are using low quality method for lazyload placeholders, Swift Performance will create a low quality version for all images. You can change the default quality and pixelate values with constants. After you change these you should clear all cache.

define(SWIFT_PERFORMANCE_LAZYLOAD_QUALITY, 7);
define(SWIFT_PERFORMANCE_LAZYLOAD_PIXELATE, 5);

Max log entries

To avoid too large logs, Swift Performance will store only the last 1000 entries in the log file. However you can override this with SWIFT_PERFORMANCE_MAX_LOG_ENTRIES constant

define(SWIFT_PERFORMANCE_MAX_LOG_ENTRIES, 1000);

Prebuild Timeout

If you run autoconfig Swift Performance will measure the correct script timeout value. By default it is 300 seconds, which you can override withSWIFT_PERFORMANCE_PREBUILD_TIMEOUT constant.

define(SWIFT_PERFORMANCE_PREBUILD_TIMEOUT, 300);

Warmup Table Limit

By default Swift Performance will store maximum 10 000 URLs in Warmup Table. You can override this withSWIFT_PERFORMANCE_WARMUP_LIMIT constant.

define(SWIFT_PERFORMANCE_WARMUP_LIMIT, 10000);

WPML Compatibility

By default Swift Performance will find WPML translations and add them to Warmup Table. You can prevent it if you define SWIFT_PERFORMANCE_WPML_WARMUP constant.

define(SWIFT_PERFORMANCE_WPML_WARMUP, false);

Max Threads

There is a limit in Swift Performance Optimization settings for maximum simultaneous threads. However you can override it with SWIFT_PERFORMANCE_THREADS constant.

define(SWIFT_PERFORMANCE_THREADS, 3);

Disable Clear Cache on commenting

By default Swift Performance will clear post cache when a new comment has been sent. You can disable this feature with
SWIFT_PERFORMANCE_CLEAR_CACHE_ON_COMMENT constant.

define(SWIFT_PERFORMANCE_CLEAR_CACHE_ON_COMMENT, true);

Server Push Prefix

If you enable Server Push feature, you may need to use a prefix if you modified the CSS or JS on the site to bypass browser and proxy cache.

define(SWIFT_PERFORMANCE_PUSH_PREFIX, ‘2-‘);

Plugin Name

In Pro version you can rename the plugin. You can use Whitelabel settings to achieve this, however you can define constants directly.

define(SWIFT_PERFORMANCE_PLUGIN_NAME, 'Swift Performance');

Plugin Name

In Pro version you can change the plugin slug. You can use Whitelabel settings to achieve this, however you can define constants directly.

define(SWIFT_PERFORMANCE_SLUG, 'swift-performance');

Plugin Cache Base Directory

In Pro version you can change the cache base directory. You can use Whitelabel settings to achieve this, however you can define constants directly.

define(SWIFT_PERFORMANCE_CACHE_BASE_DIR, 'swift-performance');

Plugin Database Prefix

In Pro version you can change the database prefix. You can use Whitelabel settings to achieve this, however you can define constants directly.

define(SWIFT_PERFORMANCE_TABLE_PREFIX, 'swift_performance');

Image Optimizer Database Table

In Pro version you can change the Image Optimizer database prefix. You can use Whitelabel settings to achieve this (it will inherit the plugin database prefix), however you can define constants directly.

define(SWIFT_PERFORMANCE_TABLE_PREFIX, 'swift_');

Alternatively you can override the whole table name with SWIFT_PERFORMANCE_IMAGE_TABLE constant.

define(SWIFT_PERFORMANCE_IMAGE_TABLE, 'swift_image_optimizer');

Disable set_time_limit

Swift Performance will try to extend the default PHP timeout if it is possible. In rare cases it can cause PHP Warning, to avoid this you can disable this feature.

define(SWIFT_PERFORMANCE_DISABLE_SET_TIME_LIMIT, true);