Make WordPress Core

Opened 4 years ago

Last modified 4 years ago

#55616 new defect (bug)

Helper function to unhook anonymous class methods

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

Description

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:

https://wordpress.stackexchange.com/a/304861

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
4 years ago

  • Summary Helper function to unhook class methodsHelper function to unhook anonymous class methods

#2 @zodiac1978
4 years ago

Related: #23259

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