WC_Tracker::is_jetpack_staging_site()
Test whether this site is a staging site according to the Jetpack criteria.
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.
After upgrading Jetpack Status to v3.3.2 is_staging_site is also deprecated and in_safe_mode is the new replacement. So we check this first of all.
Метод класса: WC_Tracker{}
Хуков нет.
Возвращает
true|false
.
Использование
$result = WC_Tracker::is_jetpack_staging_site();
Код WC_Tracker::is_jetpack_staging_site() WC Tracker::is jetpack staging site WC 9.3.3
private static function is_jetpack_staging_site() { if ( class_exists( '\Automattic\Jetpack\Status' ) ) { $jp_status = new \Automattic\Jetpack\Status(); if ( is_callable( array( $jp_status, 'in_safe_mode' ) ) ) { return $jp_status->in_safe_mode(); } elseif ( is_callable( array( $jp_status, 'is_staging_site' ) ) ) { // Preferred way of checking with Jetpack 8.1+. return $jp_status->is_staging_site(); } } return ( class_exists( 'Jetpack' ) && is_callable( 'Jetpack::is_staging_site' ) && Jetpack::is_staging_site() ); }