Make WordPress Core

Opened 6 years ago

Last modified 6 years ago

#40454 new feature request

Make plugin activation method constant

Reported by: tazotodua's profile tazotodua Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Plugins Keywords:
Focuses: administration Cc:

Description (last modified by SergeyBiryukov)

for example, there are plugins, that redirect to it's setting spage imediately after that plugin is activated (with 'activated_plugin' hook if i correctly remember).
however, when I activate plugin in bulk, bulk activation is stopped at that specific plugin, then it redirects to its settings page.

I think, there should be something like this:


so, make something , as developer could differentiate between individual and bulk activation.

Change History (4)

#1 @soulseekah
6 years ago

Right now this is possible by doing:

$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.

#2 @SergeyBiryukov
6 years ago

  • Component changed from General to Plugins
  • Description modified (diff)
  • Focuses administration added

#3 @SergeyBiryukov
6 years ago

Related/duplicate: #40252

#4 @johnbillion
6 years ago

  • Summary changed from Make plugin ACTIVATION method constant to Make plugin activation method constant
Note: See TracTickets for help on using tickets.