Custom Query to search through categories

It sounds like you’re looking for the get_terms() function that’s a wrapper for WP_Term_Query.

There you can e.g. use the name__like, description__like or search parameters.

Example:

Here’s what kind of WHERE query they generate:

'name__like'        => 'hout'  >>>  (t.name LIKE '%hout%') 

'description__like' => 'hout'  >>>  tt.description LIKE '%hout%'

'search'            => 'hout'  >>>  (t.name LIKE '%hout%') OR (t.slug LIKE '%hout%')

Leave a Comment