Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Register command execution points using named WP-CLI hooks #15

Closed
danielbachhuber opened this issue May 8, 2017 · 3 comments
Closed
Milestone

Comments

@danielbachhuber
Copy link
Member

WP-CLI runs most wp db * commands right after wp-config.php is located, but before the rest of WordPress is loaded: https://github.com/wp-cli/wp-cli/blob/d9d405a4ca01ba23e80277b8cb9000857e84e0cd/php/WP_CLI/Runner.php#L875

This is a special case system that should be switched to using named WP-CLI hooks.

From #1 (comment)

@ScreamingDev
Copy link

Having a plugin for each project in our company, we want to extend some commands. db import is one of them. After this three other commands need to run. So it would be great if the import runs after plugins were loaded.

@danielbachhuber
Copy link
Member Author

So it would be great if the import runs after plugins were loaded.

We probably won't be changing the behavior of wp db import, so I'd encourage you to find a different approach.

@diggy
Copy link
Contributor

diggy commented Aug 25, 2017

Just a small note on wp db subcommands using @WP_CLI::get_runner()->load_wordpress(); (note the error suppression with @): if there is a function definition present in wp-config.php these subcommands will fail, yielding no output at all. The error becomes clear when removing the @, e.g. Fatal error: Cannot redeclare functionname()

https://wordpress.slack.com/archives/C02RP4T41/p1503590888000029

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

No branches or pull requests

3 participants