WooCommerce::is_request()privateWC 1.0

What type of request is this?

Метод класса: WooCommerce{}

Хуков нет.

Возвращает

true|false.

Использование

// private - только в коде основоного (родительского) класса
$result = $this->is_request( $type );
$type(строка) (обязательный)
admin, ajax, cron or frontend.

Код WooCommerce::is_request() WC 8.7.0

private function is_request( $type ) {
	switch ( $type ) {
		case 'admin':
			return is_admin();
		case 'ajax':
			return defined( 'DOING_AJAX' );
		case 'cron':
			return defined( 'DOING_CRON' );
		case 'frontend':
			return ( ! is_admin() || defined( 'DOING_AJAX' ) ) && ! defined( 'DOING_CRON' ) && ! $this->is_rest_api_request();
	}
}