1

Wordpress admin search is not working for any type posts i.e posts,pages,comments or any other custom posts.

Whenever trying to search for say string without quotes "my new post"** it always returns.

Search results for ""

No matter what the search string is.

Also all of this error is on the pages related with edit.php

2
  • Has this ever been solved? Currently, I have the same error on a wordpress 5.5.1 instance. Sep 21, 2020 at 6:32
  • Hi @Erunafailaro Yes there could be multiple issues . Like you may have added extra codes in functions.php file inside wp-content folder or in the themes folder. Please remove them and test.
    – imshashi17
    Sep 23, 2020 at 10:16

1 Answer 1

1

you can try writing something that appends to your query var when the search is initiated something as such as:

    function gt_search_filter($query) {
      global $wp_query;
       if ($query->is_search)
        if($_REQUEST['s']){
           $wp_query->query_vars['s'] = $_REQUEST['s'];
        }
      return $query;
    }
    add_filter('pre_get_posts','gt_search_filter');

this worked for me but remember this is quite insecure and not advised what other thing you can do is adding more layers of filterations and everything before you finally give it to the query string.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.