Make WordPress Core

Opened 8 years ago

Closed 7 years ago

#37990 closed enhancement (wontfix)

Introduce `WP_Hooks`

Reported by: flixos90's profile flixos90 Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.7
Component: Plugins Keywords: 2nd-opinion close
Focuses: Cc:


After 38571, I wonder whether we should introduce a WP_Hooks (or WP_Hook_Manager) class to take care of all hook-related functionality. This wouldn't really have any functional benefit at this point, but I was thinking about this more related to #37699 - since the changeset mentioned above already changed the global variables in a backward-incompatible manner, maybe we can get rid of them entirely then?

Everything related that is currently stored as global, we could store as properties in the WP_Hooks class, and the WP_Hooks class could become accessible through a WP::get( 'hooks' ) or similar. The current hook functions would become wrappers for WP_Hooks methods then.

I'm aware that this would be a very critical change, however like I said, we already changed how the global variables work so we could also remove them (and direct access is discouraged anyway). Of course this would also require another dev note. Those people who really need direct access could then do WP::get( 'hooks' )->wp_filters instead of `$GLOBALSwp_filters?.

Change History (2)

#1 @DrewAPicture
7 years ago

  • Keywords close added

@flixos90 Do you have anything else to add here? It doesn't seem like there's a great deal of interest in pursuing something like this, and I'm tempted to close as wontifx, unless you're interested in pursuing this further.

#2 @flixos90
7 years ago

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

@DrewAPicture I'm fine with closing this, as it's mostly related to more general conceptual improvements of the codebase that would require a broader discussion. I think our new #core-php Slack channel is good to discuss such things, although this very ticket is unlikely to be a priority there.

If we get to such a discussion, we can probably open a general task ticket instead of circling back to this one, so I'm good closing this as wontfix for now.

Note: See TracTickets for help on using tickets.