WP_CLI\Context

Auto::deduce_best_context()privateWP-CLI 1.0

Deduce the best context to run the current command in.

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

Хуков нет.

Возвращает

Строку. Context to use.

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

// private - только в коде основоного (родительского) класса
$result = $this->deduce_best_context();

Код Auto::deduce_best_context() WP-CLI 2.8.0-alpha

private function deduce_best_context() {
	if ( $this->is_command_to_run_as_admin() ) {
		return Context::ADMIN;
	}

	return Context::CLI;
}