#62669 closed defect (bug) (reported-upstream)
deleted_plugin hook not firing?
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | General | Keywords: | |
Focuses: | Cc: |
Description
We have 2 hooks in one of our plugins:
add_action('deactivated_plugin', array(&$this, 'deactivated_plugin_log'));
add_action('deleted_plugin', array($this, 'deleted_plugin_log'));
When we call wp cli plugin delete $plugin_name --skip-plugins --skip-themes --skip-packages
, the deactivated_plugin
hook is firing. however, the deleted_plugin
hook is not.
We've also tried calling wp cli plugin deactivate --uninstall
and the hook does not appear to be firing there either.
Please let me know if there are any additional details that can help reproduce.
Change History (3)
#2
@
7 months ago
- Resolution set to reported-upstream
- Status changed from new to closed
Thanks @TobiasBg. WP CLI is odd. If you don't call --skip-plugins
, it will load up all PHP code from all plugins before running which means a bad plugin can cause WP CLI to not function at all, which can be problematic for an administrative tool.
Thanks, I'll open an issue with WP CLI and try not using --skip-plugins
(though that should only skip plugin PHP code, it shouldn't have any effect on the core hooks...hopefully)
I'm not too familiar with WP-CLI, but using
--skip-plugins
as an argument means that loading plugins is skipped, so youradd_action
call is never called?!Or of course, if your plugin is deactivated before it's deleted (in a separate request/call), its action hook handlers also won't be run.
That said, this might be a question more suitable for the WP-CLI "Issues" or "Discussions" section on https://github.com/wp-cli/wp-cli.
Of course, if this is found to be a problem with WordPress Core, this can be revisited here.