Constants

Constants are set via the wp-config.php file and will override any settings configured at the network or site level.

Settings Constants

WP_STATELESS_MEDIA_MODE

Settings name: General - Mode
accepted values (string): disabled, backup, cdn, stateless, ephemeral
default value: cdn

WP_STATELESS_MEDIA_BODY_REWRITE

Scans post content and meta during presentation and replaces local media file urls with GCS urls. When selecting meta or true depending on the amount of meta, this could be significantly impact performance negatively. This setting does not modify your database.

Settings name: General - File URL Replacement
accepted values (string): editor, meta, or true (Editor & Meta)
default value: false

WP_STATELESS_MEDIA_BODY_REWRITE_TYPES

Define the file types you would like supported with File URL Replacement, separated by space.

Settings name: General - Supported File Types
accepted values (string): file types
default value: jpg jpeg png gif pdf

WP_STATELESS_MEDIA_BUCKET

The name of the GCS bucket.

Settings name: Google Cloud Storage (GCS) - Bucket
accepted values (string): Bucket name
default value: null

WP_STATELESS_MEDIA_ROOT_DIR

If you would like files to be uploaded into a particular folder within the bucket, define that path here.

Settings name: Google Cloud Storage (GCS) - Bucket Folder
accepted values (string): Root dir
default value: null

WP_STATELESS_MEDIA_JSON_KEY

Private key in JSON text format for the service account WP-Stateless will use to connect to your Google Cloud project and bucket.

Settings name: Google Cloud Storage (GCS) - Service Account JSON
accepted values (JSON as string): JSON key
default value: null

WP_STATELESS_MEDIA_KEY_FILE_PATH

File path to private key file. File should be in JSON format.

Settings name: Google Cloud Storage (GCS) - Service Account JSON
accepted values (string): Absolute path or relative path to WordPress root directory, Content directory, Upload directory and WP Stateless plugins root directory.
default value: null

WP_STATELESS_MEDIA_CACHE_CONTROL

Override the default cache control assigned by GCS.

Settings name: Google Cloud Storage (GCS) - Cache-Control
accepted values (string): reference Google Cloud Documentation.
default value: public, max-age=36000, must-revalidate

WP_STATELESS_MEDIA_DELETE_REMOTE

Delete the GCS file when the file is deleted from WordPress.

Settings name: Google Cloud Storage (GCS) - Delete GCS File
accepted values (string): true, false
default value: true

WP_STATELESS_MEDIA_CUSTOM_DOMAIN

Replace the default GCS domain with your own custom domain. This will require you to configure a CNAME. Be advised that the bucket name and domain name must match exactly, and HTTPS is not supported with a custom domain out of the box.

Settings name: File URL - Domain
accepted values (string): Domain name
default value: storage.googleapis.com

WP_STATELESS_MEDIA_CACHE_BUSTING

WP_STATELESS_MEDIA_HASH_FILENAME (deprecated)

Prepends a random set of numbers and letters to the filename. This is useful for preventing caching issues when uploading files that have the same filename.

Settings name: File URL - Cache-Busting
accepted values (string): true, false
default value: false

WP_STATELESS_MEDIA_HIDE_SETTINGS_PANEL

Hide the WP-Stateless settings panel.

accepted values (bool): true, false
default value: none

WP_STATELESS_MEDIA_HIDE_SETUP_ASSISTANT

Hide the WP-Stateless setup assistant.

accepted values (bool): true, false
default value: none

WP_STATELESS_CONSOLE_LOG

Enables Chrome Logger log output.

accepted values (bool): true, false
default value: none

WP_STATELESS_MEDIA_UPLOAD_CHUNK_SIZE

Since 3.0.0

Enables uploading files to GCS using chunks of the specified size in bytes. Useful when server memory is limited and Allocated memory exhausted error occurs.

accepted values (int): 10485760
default value: none

WP_STATELESS_SYNC_MAX_BATCH_SIZE

Since 3.1.0

Sets the maximum size of a background sync batch of items to be saved in a single row in the database.

accepted values (int): 10
default value: 50

WP_STATELESS_SYNC_LOG

Since 3.1.0

Sets a path to a log file where to output logging information during the background sync. If not defined, a default error_log handler will be used.

accepted values (string): /var/www/my-log-file.log
default value: none

WP_STATELESS_SYNC_HEALTHCHECK_INTERVAL

Since 3.1.0

Defines an interval in minutes for a cron task that periodically checks the health of a particular background sync process.

accepted values (int): 5
default value: 1

WP_STATELESS_LEGACY_URL_TO_POSTID

Use this constant if you change the Bucket Folder (root_dir) after uploading the image. This can be a little slow at first run.

accepted values (bool): true
default value: none

WP_STATELESS_SKIP_ACL_SET

Since 3.2.5

Use this constant if your Google Storage bucket is created with uniform bucket-level access, that does not support ACL.

accepted values (bool): true
default value: false

WP_STATELESS_POSTMETA

Since 4.0.0

Read Google Cloud Storage file data from postmeta instead of the custom WP-Stateless database tables.

accepted values (bool): true
default value: false

WP_STATELESS_BATCH_HEALTHCHECK_INTERVAL

Since 4.0.0

Defines an interval in minutes for periodical health checks of a batch background process (like data optimization).

accepted values (int): 7
default value: 5
minimal value: 5

Compatibility Constants

WP_STATELESS_DYNAMIC_IMAGE_SUPPORT

WP_STATELESS_MEDIA_ON_FLY (deprecated)

Upload image thumbnails generated by your theme and plugins that do not register media objects with the media library.

accepted values (bool) true, false
default value: false

WP_STATELESS_COMPATIBILITY_GAE

Adds compatibility support for Google App Engine. Activates automatically when Google App Engine detected and sets plugin mode to Stateless. This constants allows to disable such a behavior.

accepted values (bool) true, false
default value: true (when running on Google App Engine)

WP_STATELESS_COMPATIBILITY_EDD

Adds compatibility support for Easy Digital Downloads and ensures compatibility with image cropping and WP-Stateless in the Stateless mode.

accepted values (bool): true, false
default value: false

WP_STATELESS_COMPATIBILITY_SOCSS

Ensures compatibility with CSS files generated by SiteOrigin.

accepted values (bool): true, false
default value: false

WP_STATELESS_COMPATIBILITY_GF

Enables support for these Gravity Forms features: file upload field, post image field, custom file upload field type.

accepted values (bool): true, false
default value: false

WP_STATELESS_COMPATIBILITY_WPB

Enables support for these WPBakery Page Builder features: single image element.

accepted values (bool): true, false
default value: false

WP_STATELESS_COMPATIBILITY_IMAGIFY

Enables support for these Imagify Image Optimizer features: auto-optimize images on upload, bulk optimizer, resize larger images, optimization levels (normal, aggressive, ultra).

accepted values (bool): true, false
default value: false

WP_STATELESS_COMPATIBILITY_SHORTPIXEL

Ensures compatibility with ShortPixel Image Optimizer.

accepted values (bool): true, false
default value: false

WP_STATELESS_COMPATIBILITY_WPFORMS

Ensures compatibility with WPForms.

accepted values (bool): true, false
default value: false

WP_STATELESS_COMPATIBILITY_WPSMUSH

Ensures compatibility with WP Smush.

accepted values (bool): true, false
default value: false