Add custom fields to search

please never do this: 'value' => $_GET['s']$query->get('s');, get_search_query, or sanitize_key($_GET['s']) are all safer options. Technically we shouldn’t be using get-params in wordpress at all, it’s not a best-practice. That get value could be all sorts of bad things, & we don’t want to pass it along to the db without making sure it’s clean.

Also, you’re using the LIKE operator… so you might want to add quotes around the value for stricter matching.

'value' => '"'.$query->get('s').'"';

Leave a Comment