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.
Метод класса: WC_Tracker{}
Хуков нет.
Возвращает
true|false
.
Использование
$result = WC_Tracker::is_jetpack_staging_site();
Код WC_Tracker::is_jetpack_staging_site() WC Tracker::is jetpack staging site WC 8.1.1
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() ); }