WordPress.org

Forums

Search Everything
Prevent 404s when "?s" is in the URL (3 posts)

  1. GreatBlakes
    Member
    Posted 1 year ago #

    I redirect single result searches to their respective pages, but I pass the "?s=whatever" query along with it so that I can show a "you have been redirected" bar with a search form pre-propagated with the query.

    This works great when users search for things in the standard WP core search areas (content, title, etc), but when the query is found in a custom field (or anything else that Search Everything enables) I get a 404 on the redirected page.

    I think this is because Search Everything is trying to trigger another search, but I'm not certain. Here's what I've discovered so far:

    No problems (because the query was found in the content): http://gearside.com/nebula/maecenas-porttitor-scelerisque-porta/?s=Fusce+gravida+nunc+ut+nisi+cursus+scelerisque

    404 (because the query was found in a custom field): http://gearside.com/nebula/documentation/custom-functionality/file-type-indicators/?s=path%20to%20the%20document

  2. PetraP
    Member
    Plugin Author

    Posted 1 year ago #

    Hey GreatBlakes,

    thanks for reaching out - I'll gladly help!

    You could leave s empty, as s is used for keywords:
    http://codex.wordpress.org/Class_Reference/WP_Query

    and use something else, for example another parameter in url, like this: http://gearside.com/nebula/?s=&p=bla-bla-bla or http://gearside.com/nebula/?s=&redir=bla-bla-bla .

    Hope this helps, take care and have a nice day,
    Petra

  3. GreatBlakes
    Member
    Posted 1 year ago #

    Thanks for the response. I initially programmed it using another parameter, but I prefer "s" because it is used for keywords- since in this case I'm using the search terms I like it because it pre-propagates the search field (so I don't need to duplicate functionality).

    If I absolutely had to, I could change the parameter, but I'd like to avoid any code bloat if possible.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Search Everything
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic