[wp-trac] [WordPress Trac] #56518: Terms with "0" slug do not work

WordPress Trac noreply at wordpress.org
Sun Aug 27 12:36:34 UTC 2023


#56518: Terms with "0" slug do not work
--------------------------+------------------------------
 Reporter:  serge.k       |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Taxonomy      |     Version:  6.0.2
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by Cybr):

 Changing `array_filter( $query['terms'] );` to `array_filter(
 $query['terms'], 'strlen' );` would seem logical, but it may conflict when
 it's supposed to be `term_taxonomy_id`, where `(int) 0` would be
 undesired.

 This anonymous function as the filter callback would probably be better:
 `fn ( $term ) => is_string( $term ) ? strlen( $term ) : $term`

 I'm not sure if query parameter `?cat=42` will have `42` be an integer or
 number, but `0` wouldn't be accepted here anyway and causes the query to
 break in different ways due to `$GLOBALS['wp']->query_vars` being a hole.

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


More information about the wp-trac mailing list