[wp-trac] [WordPress Trac] #57887: The WordPress core does not support calling non-static methods for hook filters and actions within a namespace

WordPress Trac noreply at wordpress.org
Wed Mar 8 15:49:37 UTC 2023


#57887: The WordPress core does not support calling non-static methods for hook
filters and actions within a namespace
-------------------------------+-----------------------------------------
 Reporter:  markcarbonell2013  |       Owner:  (none)
     Type:  defect (bug)       |      Status:  closed
 Priority:  normal             |   Milestone:
Component:  General            |     Version:
 Severity:  normal             |  Resolution:  invalid
 Keywords:  close              |     Focuses:  rest-api, coding-standards
-------------------------------+-----------------------------------------
Changes (by hellofromTonya):

 * status:  new => closed
 * version:  6.1.1 =>
 * resolution:   => invalid
 * milestone:  Awaiting Review =>


Comment:

 Hello @markcarbonell2013,

 Welcome to WordPress Core's Trac!

 WordPress does allow a static method to be registered as the callback for
 a hook as @jrf points out. A fully qualified class name is needed (rather
 than `$this`) (for example https://3v4l.org/JUdlA).

 As this is not a Core bug, I'm closing this ticket.

 If you need further help, the [https://wordpress.org/support/forums/
 Support forums] are available.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/57887#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list