Opened 3 years ago

Last modified 3 years ago

#13992 new enhancement

get_terms() has 'search' and 'name__like'

Reported by: dd32 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)

13992.diff (675 bytes) - added by wojtek.szkutnik 3 years ago.

Download all attachments as: .zip

Change History (9)

comment:1   dd323 years ago

  • Keywords needs-patch added

comment:2   dd323 years ago

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.

I would prefer removing 'search' instead, as it's unclear what fields are actually being searched.

comment:4   dd323 years ago

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?
  • Cc wojtek.szkutnik@… added
  • Keywords has-patch added; needs-patch removed
  • Keywords gsoc added

Added diff that includes your suggestions, with search looking for name OR slug. No need to include description IMO.

  • Cc kevinB added
  • Milestone changed from Awaiting Triage to Future Release
  • Type changed from defect (bug) to enhancement
Note: See TracTickets for help on using tickets.