WP_CLI\Context
Auto::deduce_best_context()
Deduce the best context to run the current command in.
Method of the class: Auto{}
No Hooks.
Return
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.8.0-alpha
private function deduce_best_context() { if ( $this->is_command_to_run_as_admin() ) { return Context::ADMIN; } return Context::CLI; }