Search not bringing back results of main query
-
Dear WordPress community members,
I’m really stumped on this one, have been at it for days…
I have an advanced search function in my theme which works on the pre_get_posts, and it’s been working fine for a couple of years until recently.
Now instead of displaying the results, have_posts shows as empty. I installed Query Monitor in my WordPress installation (and was blown away by the amount of queries for each page), and was able to locate in the list of queries being called the one which should be triggered by the advanced search.
Query Monitor even put a purple “Main Query” indicator next to it, I copied the corresponding SQL SELECT code from the monitor, ran it directly in PhpMyAdmin and got back all the results that should be coming back for this search.
My only conclusion is that the have_posts is not giving back results for the “Main Query” as indicated by the Monitor, although when I run is_main_query() it comes back as true.
Where oh where oh where did I go wrong?
Hopefully thankful,
Helmsberger
- The topic ‘Search not bringing back results of main query’ is closed to new replies.