Skip to content

Avoid use of @WP_CLI::get_runner()->load_wordpress(); in wp db * commands #50

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
danielbachhuber opened this issue Sep 21, 2017 · 0 comments
Milestone

Comments

@danielbachhuber
Copy link
Member

danielbachhuber commented Sep 21, 2017

wp db search (and other wp db * commands) call @WP_CLI::get_runner()->load_wordpress(); because WP-CLI executes wp db * commands after wp-config.php has loaded but before the rest of WordPress has loaded: https://github.com/wp-cli/wp-cli/blob/d9d405a4ca01ba23e80277b8cb9000857e84e0cd/php/WP_CLI/Runner.php#L875

Calling @WP_CLI::get_runner()->load_wordpress(); to avoid redefinition of constants in wp-config.php is a hack. Instead, these commands should continue loading WordPress without loading wp-config.php again.

Related #15

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

1 participant