Hooks

Docs Hooks Pro · Updates

modal_kit_pro_is_staging

filter

Pro

PHP

Say whether a site is staging or local. Those check the license key without using one of its sites, and still get updates.

On a staging or local site, Pro checks the license key without activating it, so the site doesn’t use one of the key’s sites. On a live site, it activates the key.

By default a site is staging or local when wp_get_environment_type() isn’t production, when its address has no dot or is an IP address, when it ends in a local name such as .local, .test or .ddev.site, when it’s a host’s staging address (WP Engine and Kinsta staging, Pantheon, Flywheel, Cloudways, InstaWP and others), or when IS_WPE_SNAPSHOT, KINSTA_DEV_ENV or WPSTAGECOACH_STAGING is set. Use this filter for addresses that list doesn’t know.

Runs when a key is activated, in the daily license check and when the License tab opens. On a site without an activation, it also runs whenever Pro decides whether the site can download updates.

Parameters

Parameter

Description

$staging

bool

Whether Pro counts the site as staging or local.

Returns

bool true for a staging or local site, false for a live one. Cast to a boolean.

Examples

Your agency’s staging domain

Client sites are copied to client.staging.agency.example for review.

PHP

add_filter( 'modal_kit_pro_is_staging', function ( $staging ) {
  $host = (string) wp_parse_url( home_url(), PHP_URL_HOST );

  return $staging || str_ends_with( $host, '.staging.agency.example' );
} );

A live shop on a host’s temporary address

The shop runs on its Cloudways address until its domain moves over, so it should use one of the key’s sites.

PHP

add_filter( 'modal_kit_pro_is_staging', function ( $staging ) {
  $host = (string) wp_parse_url( home_url(), PHP_URL_HOST );

  return 'shop-1234.cloudwaysapps.com' === $host ? false : $staging;
} );

Good to know

A change applies at the next license check: daily, when the License tab opens, or with Check again on Dashboard → Updates. A site that goes live is activated then.

Counting a live site as staging doesn’t free the site it already uses. To free it, press Deactivate on this site, then activate the key again.

Setting WP_ENVIRONMENT_TYPE in wp-config.php does the same for the whole site, and other plugins read it too.

On a multisite network, only the main site checks the license, so only its address counts.

Applied in modal-kit-pro/includes/License.php.

Need a hook that isn’t here?