Opened 3 years ago
Last modified 3 years ago
#13992 new enhancement
get_terms() has 'search' and 'name__like'
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Future Release |
| Component: | Taxonomy | Version: | 3.0 |
| Severity: | normal | Keywords: | has-patch gsoc |
| Cc: | wojtek.szkutnik@…, kevinB |
Description
Both do similar things:
if ( !empty($name__like) )
$where .= " AND t.name LIKE '{$name__like}%'";
...
if ( !empty($search) ) {
$search = like_escape($search);
$where .= " AND (t.name LIKE '%$search%')";
}
namelike should be removed in favour of search IMO, unless that functionality is intended, and in that case, namelike should get like_escape() applied
Attachments (1)
Change History (9)
I would prefer removing 'search' instead, as it's unclear what fields are actually being searched.
After thinking a bit more
- name__like should get escaped, and work as it currently does
- search should do both name AND slug, Not sure description is worth it?
comment:5
wojtek.szkutnik — 3 years ago
- Cc wojtek.szkutnik@… added
- Keywords has-patch added; needs-patch removed
wojtek.szkutnik — 3 years ago
comment:6
wojtek.szkutnik — 3 years ago
- Keywords gsoc added
Added diff that includes your suggestions, with search looking for name OR slug. No need to include description IMO.
Note: See
TracTickets for help on using
tickets.

in addition to that, Terms are stored in the database htmlspecialchar'd by the looks of it (ie. '&'), The search should take that into consideration and apply the same filtering to the searching term.