Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

WC_Tracker::is_jetpack_staging_site()

Test whether this site is a staging site according to the Jetpack criteria.


Description Description

With Jetpack 8.1+, Jetpack::is_staging_site has been deprecated. \Automattic\Jetpack\Status::is_staging_site is the replacement. However, there are version of JP where \Automattic\Jetpack\Status exists, but does not contain is_staging_site method, so with those, code still needs to use the previous check as a fallback.


Return Return

(bool)


Top ↑

Source Source

File: includes/class-wc-tracker.php

	private static function is_jetpack_staging_site() {
		if ( class_exists( '\Automattic\Jetpack\Status' ) ) {
			// Preferred way of checking with Jetpack 8.1+.
			$jp_status = new \Automattic\Jetpack\Status();
			if ( is_callable( array( $jp_status, 'is_staging_site' ) ) ) {
				return $jp_status->is_staging_site();
			}
		}

		return ( class_exists( 'Jetpack' ) && is_callable( 'Jetpack::is_staging_site' ) && Jetpack::is_staging_site() );
	}


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.