WP_CLI\Context
Auto::deduce_best_context
Deduce the best context to run the current command in.
Method of the class: Auto{}
No Hooks.
Returns
String. Context to use.
Usage
// private - for code of main (parent) class only $result = $this->deduce_best_context();
Auto::deduce_best_context() Auto::deduce best context code WP-CLI 2.13.0-alpha
private function deduce_best_context() {
if ( $this->is_command_to_run_as_admin() ) {
return Context::ADMIN;
}
return Context::CLI;
}