Skip to content

Configuration & Constants

Daniel M. Hendricks edited this page Aug 25, 2017 · 8 revisions

Constants

Defined by Plugin

VERSION

Contains the version of the plugin as defined in the header of the main plugin file and available to other files (such as functions.php).

echo \VendorName\PluginName\VERSION;

Available to Plugin

The following constants are available for you to define in wp-config.php:

WP_ENV

An optional constant that defines the environment. If not set, defaults to 'production'.

This constant is is the the is_production() function in app/Plugin.php. This can be useful when you want different behavior in production, staging, development or other environment.

define( 'WP_ENV', 'development' );

WP_ENCRYPT_KEY

The Utils::encrypt() and Utils::decrypt() helpers use the SECURE_AUTH_KEY in wp-config.pgp by default. You may specify an alternate salt by defining:

define( 'WP_ENCRYPT_KEY', 'random_string' );

If you need a random string, visit the salt page or throw an MD5 in there.

WPTK_DISABLE_CACHE

Disables object caching (where available) when defined as true true.

define( 'WPTK_DISABLE_CACHE', true );

plugin.json

This plugin loads many of its defaults & settings from plugin.json. You may change the settings as desired.

You may put add additional settings that you wish to make available to your plugin.

prefix

Contains the plugin's prefix, used for wp_options and other field names.

short_name

A shorted name for the plugin, potentially useful for WP Admin menu item names when the actual plugin name is long (and wraps).

object_cache

Define object cache settings:

  • group - The object cache group key that is unique to the plugin under which all cached objects are stored.
  • expire_hours - The number of hours to cache settings before they automatically expire.

dependencies

A list of dependencies and versions to check for. By default, this plugin checks for required minimum versions of PHP and Carbon Fields.

encrypt_method

The cypher method used by the Utils::encrypt() and Utils::decrypt() functions.