[wp-trac] [WordPress Trac] #25231: wp_ajax_ajax_tag_search should use get_terms instead of a custom query

WordPress Trac noreply at wordpress.org
Mon Sep 16 17:48:55 UTC 2013


#25231: wp_ajax_ajax_tag_search should use get_terms instead of a custom query
-------------------------+------------------
 Reporter:  Chouby       |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  3.7
Component:  Taxonomy     |     Version:
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |
-------------------------+------------------

Comment (by nacin):

 Before: SELECT t.name FROM $wpdb->term_taxonomy AS tt INNER JOIN
 $wpdb->terms AS t ON tt.term_id = t.term_id WHERE tt.taxonomy = %s AND
 t.name LIKE (%s)"

 After: SELECT t.term_id, tt.parent, tt.count, t.name FROM wp_terms AS t
 INNER JOIN wp_term_taxonomy AS tt ON t.term_id = tt.term_id WHERE
 tt.taxonomy IN ('post_tag') AND t.name LIKE '%apple%' ORDER BY t.name ASC

 `name__like` has two underscores. Also, this wouldn't have been possible
 without [25241]. I also like the ORDER BY, though it would probably be
 better to match based on LIKE '$name', then LIKE '$name%', then finally
 LIKE '%$name%'. This doesn't change functionality, though, so looks good.

--
Ticket URL: <http://core.trac.wordpress.org/ticket/25231#comment:3>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list