[wp-trac] [WordPress Trac] #35357: Introduce did_filter()

WordPress Trac noreply at wordpress.org
Sun Jul 31 14:18:51 UTC 2022

#35357: Introduce did_filter()
 Reporter:  mordauk                              |       Owner:  chriscct7
     Type:  enhancement                          |      Status:  closed
 Priority:  normal                               |   Milestone:  6.1
Component:  Plugins                              |     Version:  2.1
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests needs-      |     Focuses:
  testing                                        |
Changes (by SergeyBiryukov):

 * status:  accepted => closed
 * resolution:   => fixed


 In [changeset:"53803" 53803]:
 #!CommitTicketReference repository="" revision="53803"
 Plugins: Introduce `did_filter()` function.

 While most of the action functions are aliases for the respective filter
 functions, using `did_action()` to detect whether a filter has been run is
 not possible, as it only works specifically for actions.

 This is now resolved by introducing a new function, `did_filter()`, which
 retrieves the number of times a filter has been applied during the current
 request, bringing parity with `did_action()`.

 Follow-up to [4630], [6318], [27294].

 Props mordauk, chriscct7, andykeith, nacin, dd32, markparnell,
 Fixes #35357.

Ticket URL: <https://core.trac.wordpress.org/ticket/35357#comment:25>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list