WordPress.org

Make WordPress Core

Opened 9 months ago

Last modified 8 months ago

#21883 new enhancement

WP_Plugin action/filter concept

Reported by: johnjamesjacoby Owned by:
Priority: lowest Milestone: Awaiting Review
Component: Plugins Version:
Severity: minor Keywords:
Cc:

Description

Attached is a concept for allowing plugins to have dedicated action/filter loops.

The problem:

  • Plugins like BuddyPress and bbPress that have their own actions and filters pollute the global action/filter namespace. This isn't necessarily bad, but it's arguably not optimal.
  • Allowing plugins to have their own action/filter hooks means mirror action/filter names to match what's used in WordPress, without adding more items to the global action/filter array.
  • BuddyPress and bbPress namespace their actions with prefixes, I.E. 'bp_init', 'bp_ready' et all. This works fine, and is straightforward to use, so I'm not really even sure this patch is that good.
  • More conceptual than anything; it's intended as a fun experiment to toy with a new way of looking at WordPress how actions/filters might evolve in the future.

Attached is a big patch with a small example file. The patch is ugly looking, due to running out of time in the day and wanting feedback sooner.

Attachments (2)

example.php (266 bytes) - added by johnjamesjacoby 9 months ago.
class-wp-plugin.patch (44.2 KB) - added by johnjamesjacoby 9 months ago.

Download all attachments as: .zip

Change History (4)

johnjamesjacoby9 months ago

comment:1 scribu8 months ago

Related: #22256

comment:2 scribu8 months ago

I don't see why you'd want to have your own 'init' action, but which doesn't necessarily fire at the same time as WP's 'init' action.

Note: See TracTickets for help on using tickets.