Make WordPress Core

Opened 13 years ago

Closed 13 years ago

#25231 closed enhancement (fixed)

wp_ajax_ajax_tag_search should use get_terms instead of a custom query

Reported by: Chouby Owned by: nacin
Priority: normal Milestone: 3.7
Component: Taxonomy Version:
Severity: normal Keywords: has-patch
Cc: Focuses:

Description

The goal is to take profit of all advantages of the get_terms function: cache, filters...

Attachments (1)

25231.patch (709 bytes ) - added by Chouby 13 years ago.

Download all attachments as: .zip

Change History (5)

@Chouby
13 years ago

#1 @Chouby
13 years ago

  • Keywords has-patch added

#2 @SergeyBiryukov
13 years ago

  • Milestone Awaiting Review3.7

#3 @nacin
13 years ago

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.

#4 @nacin
13 years ago

  • Owner set to nacin
  • Resolutionfixed
  • Status newclosed

In 25452:

Use get_terms() in the ajax tag search.

props Chouby.
fixes #25231.

Note: See TracTickets for help on using tickets.