Automattic\WooCommerce\Internal\Abilities
AbilitiesTracking::get_channel
Identify how the ability was invoked.
Метод класса: AbilitiesTracking{}
Хуков нет.
Возвращает
string.
Использование
// private - только в коде основоного (родительского) класса $result = $this->get_channel(): string;
Код AbilitiesTracking::get_channel() AbilitiesTracking::get channel WC 11.3.0
private function get_channel(): string {
if ( $this->is_mcp_request() ) {
return 'mcp';
}
foreach ( $this->rest_requests as $request ) {
if ( 1 === preg_match( self::ABILITIES_RUN_ROUTE_REGEX, $request->get_route() ) ) {
return 'rest';
}
}
// Before WP-CLI: `wp cron event run` defines DOING_CRON, and that is scheduled work, not an agent.
if ( wp_doing_cron() ) {
return 'cron';
}
if ( defined( 'WP_CLI' ) && WP_CLI ) {
return 'cli';
}
return 'other';
}