最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Admin search not working for any type of post

programmeradmin0浏览0评论

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.

发布评论

评论列表(0)

  1. 暂无评论