Unfunctional search on web - no results on valid key word

Hello, I’m trying to solve search problem.
When I ask any valid key word (i know the page with this key word exist) on navbar search, there are no results. It’s always only “no results” page. How can I fix it? Thanks for your help.
http://www.zamekkurim.cz
Tereza

hi There,

Thanks for writing in!
Please send us your website details so that we can investigate the reason of the issue!
Please provide following information:
Set it as Secure Note

  • Link to your site
  • WordPress Admin username / password

All the best!

here is the secure note:

Hi There,

I remove this code and the search function is working fine again:

function redirect_if_search_is_empty($wp_query) {
  global $wp_query;
  if ( $wp_query->is_search() && $wp_query->found_posts <=0 ) {
    wp_redirect( 'http://www.zamekkurim.cz/nenalezeno/' );
    exit;
  }
}
add_action('parse_query', 'redirect_if_search_is_empty');

Cheers!

1 Like

Amazing! Thank you wery much :).

You are most welcome!

Hi, i know its little bit disturbing but I’d like to ask you to do this thing for another our website where is same problem, Is it possible, please?

Hey @nezzazvoni,

Please check your functions.php for the code that @thai has removed or any additional function that is related to search.

Thanks.

Ok, we will try but can you tell as a way? Where exactly in administration can we find this code? Thanks.

Hello there,

You need to login into your server first by using your FTP login details.

Then from there, find your child theme’s functions.php on this directory: wp-content/themes/x-child/functions.php

Open that file in your text editor, and removed all functions related to search.

If you’re not sure how to do this, I suggest you ask assistance from your developer.

Let us know if you have further question. Thank you.

We did it and everything is working now. Thank you again. T

You are welcome!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.