[wp-trac] [WordPress Trac] #40454: Make plugin ACTIVATION method constant
WordPress Trac
noreply at wordpress.org
Fri Apr 14 21:17:49 UTC 2017
#40454: Make plugin ACTIVATION method constant
-----------------------------+------------------------------
Reporter: tazotodua | Owner:
Type: feature request | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version:
Severity: normal | Resolution:
Keywords: | Focuses:
-----------------------------+------------------------------
Comment (by soulseekah):
Right now this is possible by doing:
{{{#!php
<?php
$bulk_activation = (new WP_Plugins_List_Table())->current_action() ==
'activate-selected';
if ( ! $bulk_activation ) {
/** Redirect, etc. */
}
}}}
One obvious issue is that "activate-selected" might change as an action
name in the future.
Same can be done with 'deactivate-selected'.
Just an idea.
Another option is to check the function call backtrace, all the way up to
`activate_plugin` and then one more step up to see if it's
`activate_plugins` or not.
A bit hacky, but will work, as well.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/40454#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list