[wp-trac] [WordPress Trac] #27810: wp_query taxonomy query by name doesn't seem to work if there's a space in the name

WordPress Trac noreply at wordpress.org
Fri Feb 6 13:38:32 UTC 2015


#27810: wp_query taxonomy query by name doesn't seem to work if there's a space in
the name
--------------------------+---------------------------
 Reporter:  neonWired     |       Owner:  boonebgorges
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:  4.2
Component:  Taxonomy      |     Version:  3.9
 Severity:  normal        |  Resolution:  fixed
 Keywords:                |     Focuses:
--------------------------+---------------------------

Comment (by jeffmcmahan):

 Replying to [comment:5 boonebgorges]:

 > > If query is by name and the string is not numeric, pass it to
 sanitize_title() and then run the query by slug. That'll work in every
 case except where there are duplicate names (and in that case, one cannot
 complain).
 >
 > No, because it's possible to create a term with a `name` that is totally
 unrelated to the `slug`. The correct fix is to use `sanitize_term_field()`
 instead of `sanitize_title_for_query()` inside of
 `WP_Tax_Query::transform_query()`.

 Oh that's right - I forgot about the direct editing of slugs.

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


More information about the wp-trac mailing list