Make WordPress Core

Opened 12 years ago

Closed 7 years ago

#21883 closed enhancement (maybelater)

WP_Plugin action/filter concept

Reported by: johnjamesjacoby's profile johnjamesjacoby Owned by:
Milestone: Priority: lowest
Severity: minor Version:
Component: Plugins Keywords: close reporter-feedback
Focuses: 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 12 years ago.
class-wp-plugin.patch (44.2 KB) - added by johnjamesjacoby 12 years ago.

Download all attachments as: .zip

Change History (7)

#1 @scribu
11 years ago

Related: #22256

#2 @scribu
11 years 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.

#3 @alex-ye
10 years ago

  • Cc nashwan.doaqan@… added

#4 @DrewAPicture
8 years ago

  • Keywords close reporter-feedback added

@johnjamesjacoby: Are you still planning to pursue this? With #17817 in contention, your approach might need a rework.

#5 @dd32
7 years ago

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

"polluting" the global filter/action space isn't necessarily an issue, prefix everything is a pretty standard WordPress "thing".

I'm going to close this as maybelater as a WP_Plugin class will probably happen sometime down the line - but not likely for action/filter segregation.
See proposals such as #37677 and #37656 for other examples.

Note: See TracTickets for help on using tickets.