[Resolved] /?s= is returning a null set of results rather than all results

Home Forums Support [Resolved] /?s= is returning a null set of results rather than all results

Home Forums Support /?s= is returning a null set of results rather than all results

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #452643
    Phil

    Hi!

    How should I modify the default search.php to deliver all results when no search term is specified?

    Thanks!

    #452648
    Tom
    Lead Developer
    Lead Developer

    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.

    #452879
    Phil

    Thank you!

    I noticed that on generatepress.com, a null string pulls in the latest blog posts:

    https://generatepress.com/?s=

    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!

    #453163
    Tom
    Lead Developer
    Lead Developer

    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?

    #453175
    Phil

    I agree with you! It looks like a problem other than something related to GeneratePress.

    Thanks for looking into it!

    #453194
    Tom
    Lead Developer
    Lead Developer

    No problem – you can try deactivating your plugins one by one until it starts working to find the issue ๐Ÿ™‚

    #453203
    Phil

    Thanks!

    #453419
    Tom
    Lead Developer
    Lead Developer

    No problem!

    #453425
    Phil

    Oh, btw, it was Relevanssi that was hanging things. I’m now working with them to figure out why. Appreciated it!

    #453428
    Tom
    Lead Developer
    Lead Developer

    Thanks for letting me know! ๐Ÿ™‚

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.