Make WordPress Core

Opened 2 years ago

Last modified 2 years ago

#55616 new defect (bug)

Helper function to unhook anonymous class methods

Reported by: johnjamesjacoby's profile johnjamesjacoby Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Plugins Keywords: 2nd-opinion
Focuses: Cc:


Problem: it’s pretty common (even if it’s not polite) for plugins to use a class constructor to hook their own public methods into things, but doing so makes it near-impossible to unhook procedurally.

Solution: I just ran across the following function on StackExchange, and imagined something similar could be quite useful to have globally available:

It’s gnarly, but it works, and I think having WordPress core include this functionality makes more sense than having plugin authors all include their own version of it.

Change History (3)

#1 @johnjamesjacoby
2 years ago

  • Summary changed from Helper function to unhook class methods to Helper function to unhook anonymous class methods

#2 @zodiac1978
2 years ago

Related: #23259

Last edited 2 years ago by SergeyBiryukov (previous) (diff)
Note: See TracTickets for help on using tickets.