I'm working on a modified vanilla WordPress search form. The form is searching for 'clients' posts. Vanilla wordpress form search inside title and content of posts. I want to change that.
I tried differents plugins (Relevanssi, searchwp, ajax search pro) none of these fit my needs because the form is way more complexe than what it seems (auto-complete, suggest, results based on localisation). So the solution need to be plugin less.
My search form look like this
<form action="/" method="get" id="projet-search" role="search">
<div>
<input class="search-field" name="s" id="nom" type="text" maxlength="256">
<input type="hidden" name="post_type[]" value="clients">
</div>
<div>
<button type="submit" id="searchsubmit" value="Search">Search</button>
</div>
</form>
What i have right now : Form return 'clients' search is limited to post title or all taxonomy using https://stackoverflow.com/a/59537500/11736798
The behavior i want is : Form return 'clients' and limit search to post title or 'specialites' taxonomy
Is there a way to do this ?
Have a wonderful day you amazing peoples :)
terms
andterm_relationships
tables. Try to add a WHERE condition, that limitsterm_relationships.term_taxonomy_id
to the one specific ID of your "specialities" taxonomy.