Add filter post_where and passing post_type argument
Remove this part from your posts_where filter: if (is_search() && get_search_query()) Note that is_search() is a check on the main query. If you want to target the main search query, there’s the posts_search filter available. Important: Watch out for possible SQL injections, as you are taking user input into the SQL query. I think the … Read more