Make WordPress Core

Opened 7 years ago

Closed 3 months ago

#40454 closed feature request (duplicate)

Make plugin activation method constant

Reported by: tazotodua's profile tazotodua Owned by:
Milestone: 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 (6)

#1 @soulseekah
7 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
7 years ago

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

#3 @SergeyBiryukov
7 years ago

Related/duplicate: #40252

#4 @johnbillion
7 years ago

  • Summary changed from Make plugin ACTIVATION method constant to Make plugin activation method constant

#5 @swissspidy
3 months ago

#55767 was marked as a duplicate.

#6 @swissspidy
3 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #40252.

Note: See TracTickets for help on using tickets.