WordPress.org

Ready to get started?Download WordPress

Forums

Search page shows nothing if results are not accurate (3 posts)

  1. hildergarn
    Member
    Posted 2 years ago #

    I'm testing a blog I'm building on wordpress and at the moment the search form works OK, but when I search for rubbish words it shows a blank page. Is it possible to tell the search form to display the 404 page?

    Let me display the code of my search.php template.

    Thanks in advance!

  2. KrashKartMedia
    Member
    Posted 2 years ago #

    The search page works like this:

    the key word you search for is taken and ran through your site. if matches come up, they are show. If not, you are still taken to the search page, because the search button has a action method.

    So you could write a function into the search page that says, if nothing is found, return some sort of html or php code.

  3. hildergarn
    Member
    Posted 2 years ago #

    What function will be great to add KrashKartMedia? Sorry, but I'm not good at php :(

    thanks for your reply BTW :)

Topic Closed

This topic has been closed to new replies.

About this Topic