Opened 10 years ago
Closed 10 years ago
#25231 closed enhancement (fixed)
wp_ajax_ajax_tag_search should use get_terms instead of a custom query
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 3.7 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Taxonomy | Keywords: | has-patch |
Focuses: | Cc: |
Description
The goal is to take profit of all advantages of the get_terms function: cache, filters...
Attachments (1)
Change History (5)
Note: See
TracTickets for help on using
tickets.
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.