Archived topic
/?s= is returning a null set of results rather than all results
9 replies · Started by Phil on December 18, 2017
Hi!
How should I modify the default search.php to deliver all results when no search term is specified?
Thanks!
Hmm I wonder if there's a way to tell WP to query all posts if the search is empty using a filter like: https://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts
It may be worth asking over on https://wordpress.stackexchange.com/.
Otherwise you would likely need to add the no-results.php file to your child theme, then write the query in there.
Thank you!
I noticed that on generatepress.com, a null string pulls in the latest blog posts:
Is that what should be happening with the existing search.php template? My /?s= gets a "Nothing found". If I can get it to pull in the latest posts instead, that would be perfect!
Ah strange - that should be the default then, as generatepress.com doesn't do anything special in this area.
Perhaps you have a plugin conflicting with the query?
I agree with you! It looks like a problem other than something related to GeneratePress.
Thanks for looking into it!
No problem - you can try deactivating your plugins one by one until it starts working to find the issue :)
Thanks!
No problem!
Oh, btw, it was Relevanssi that was hanging things. I'm now working with them to figure out why. Appreciated it!
Thanks for letting me know! :)