[wp-trac] [WordPress Trac] #40280: Short-circuit filters can't return common values

WordPress Trac noreply at wordpress.org
Tue Mar 28 05:39:20 UTC 2017


#40280: Short-circuit filters can't return common values
-------------------------+------------------------------
 Reporter:  andy         |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  General      |     Version:  trunk
 Severity:  normal       |  Resolution:
 Keywords:               |     Focuses:
-------------------------+------------------------------

Comment (by flixos90):

 I like the approach of a centralized function since it is easier to use
 than the currently existing checks and provides a standardized way to
 short-circuit functions that core and plugins could benefit from.

 Regarding the implementation we would need to make sure that the function
 can accept further values properly as the regular one can as well.

 Replying to [comment:2 DrewAPicture]:
 > That said, I wonder if maybe moving completely away from the "apply
 filters" vernacular altogether would help globally clarify the intent
 rather than further confuse the space of actions and filters.

 I'm not sure removing the `apply_filters` from the name is more
 clarifying. Also with having `apply_filters` in there, it becomes more
 clear that calls of that function should be documented in a similar way as
 regular `apply_filters()` calls. See also `apply_filters_deprecated()`
 which wraps `apply_filters()` with custom logic as well.

 That core is sometimes using `false` and at other times `null` indicates
 the lack of a standard here. Even if we decide against such a function, I
 think we should figure out a uniform way for short-circuiting and document
 that in the handbook going forward.

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


More information about the wp-trac mailing list