wp --context=admin doesn't trigger admin_init action
Bug Report
- [x] Yes, I reviewed the contribution guidelines.
- [x] Yes, more specifically, I reviewed the guidelines on how to write clear bug reports.
Describe the current, buggy behavior
WP-CLI has got a cool feature "execution context". I have found that "admin" context doesn't trigger admin_init action.
Describe how other contributors can replicate this bug
- add hook for admin_init action with debug code
- run any command with --context=admin
Describe what you expect as the correct outcome
admin_init action is triggered
Let us know what environment you are running this on
WP-CLI version: 2.6.0
Provide additional context/screenshots
do_action( 'admin_init' ); performs in the wp-admin/admin.php file.
Looks like admin context of wp-cli, requires this file inside admin_init action handler here
So, so there is no place to trigger this action.
From Slack conversation https://wordpress.slack.com/archives/C02RP4T41/p1658199286371689
Thanks for the report, @d1sparity-plesk
- add hook for admin_init action with debug code
- run any command with --context=admin
Just to confirm, where is your hook registered? Can you provide a code sample that reproduces the issue?
Just to confirm, where is your hook registered? Can you provide a code sample that reproduces the issue?
@d1sparity-plesk Nevermind, I understand what's going on now.
Fixed via #5663