WP_CLI\Context
Admin::process()
Process the context to set up the environment correctly.
Метод класса: Admin{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
$Admin = new Admin(); $Admin->process( $config );
- $config(массив) (обязательный)
- Associative array of configuration data.
Код Admin::process() Admin::process WP-CLI 2.8.0-alpha
public function process( $config ) { if ( defined( 'WP_ADMIN' ) ) { if ( ! WP_ADMIN ) { WP_CLI::warning( 'Could not fake admin request.' ); } return; } WP_CLI::debug( 'Faking an admin request', Context::DEBUG_GROUP ); // Define `WP_ADMIN` as being true. This causes the helper method // `is_admin()` to return true as well. define( 'WP_ADMIN', true ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedConstantFound // Set a fake entry point to ensure wp-includes/vars.php does not throw // notices/errors. This will be reflected in the global `$pagenow` // variable being set to 'wp-cli-fake-admin-file.php'. $_SERVER['PHP_SELF'] = '/wp-admin/wp-cli-fake-admin-file.php'; // Bootstrap the WordPress administration area. WP_CLI::add_wp_hook( 'init', function () { $this->log_in_as_admin_user(); $this->load_admin_environment(); }, defined( 'PHP_INT_MIN' ) ? PHP_INT_MIN : -2147483648, // phpcs:ignore PHPCompatibility.Constants.NewConstants.php_int_minFound 0 ); }