If someone enters input for our WordPress site search (so something like https://www.example.com/?s=nonexistentcontent), it still redirects the user to the default 404 page. Is there a way to have the Custom 404 plugin take precedence there?
Hi @agorder.
Thanks for reaching out!
If someone input wrong keywords on your search bar it should redirect to the custom 404 page if you enable it. I suspect there could be a plugin conflict why it is acting that way, I suggest that you do this common troubleshooting.
Hope that helps and let us know how it goes.
Nope, I still get that 404 page if I disable every plugin for our site.
Hi Jeremy,
The Search Result page is not the same as the 404 page
The page you see here (https://www.yourdomain.com/?s=seachkeyword) is not the 404 page, its the Search Result page, if you need a custom Search Result page, you can create one using the Layout Builder and set that to Search Result page.
Hope it helps,
Cheers!
Interesting. Why then do valid search results (for content that actually exists on site) display properly? Is it because WP is already preconfigured to display valid results? And so the Search Result page I am building will only show up for when there are no search results available? Or can it be dynamic and handle both?
Hi Jeremy,
It’s not about the Valid or Invalid result. The WordPress search page shows the output based on the search result and shows the No Result Found page if there is no result found and that No Result Found is the part of the Search Result page. Whereas the 404 page is completely different, it actually catches the HTTP 404 error and shows when a Page or Post or any URL is requested is not available on your site.
If you still want to show some different output or the content from the 404 page in the search result page while no content is found, please follow the suggestion given by my colleague.
Hope it helps.
Thanks
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.