Replacing search results with custom external query
You can’t return a query object from a pre_get_posts action. In fact, it shouldn’t return anything, the query object is passed by reference. Your second attempt is close, you can unset the s query var so WordPress doesn’t try to search on that term. Of course, now s has no value, so any functions that … Read more