WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 2 years ago

Last modified 19 months ago

#34309 closed enhancement (wontfix)

New function: `add_multiple_actions()` and `add_multiple_filters()`

Reported by: sebastian.pisula Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Plugins Keywords:
Focuses: Cc:

Description (last modified by SergeyBiryukov)

Sometimes I need create filter for few elements with __return_true

So for example:

$tags = array
(
'install_theme_complete_actions', 
'use_default_gallery_style', 
'show_recent_comments_widget_style'
);

add_multiple_filters($tags, '__return_true');

Attachments (1)

34309.patch (1.6 KB) - added by sebastian.pisula 4 years ago.

Download all attachments as: .zip

Change History (6)

#2 @swissspidy
4 years ago

Why not just using this:

foreach( array( 'install_theme_complete_actions', 'use_default_gallery_style' ) as $hook ) {
add_filter($hook, '__return_true');
}

You can also create a add_multiple_filters helper function on your own that does this.

Otherwise I recommend reading the discussion on #14280.

#3 @SergeyBiryukov
4 years ago

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

#4 @SergeyBiryukov
2 years ago

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

No traction in 20 months, closing per comment:2.

#5 @SergeyBiryukov
19 months ago

#41961 was marked as a duplicate.

Note: See TracTickets for help on using tickets.