admin管理员组

文章数量:1310043

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

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

Share Improve this question edited May 22, 2020 at 14:57 fuxia 107k38 gold badges255 silver badges459 bronze badges asked May 21, 2020 at 22:26 imshashi17imshashi17 215 bronze badges 2
  • Has this ever been solved? Currently, I have the same error on a wordpress 5.5.1 instance. – Erunafailaro Commented 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 Commented Sep 23, 2020 at 10:16
Add a comment  | 

1 Answer 1

Reset to default 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.

本文标签: Admin search not working for any type of post