简体   繁体   中英

Cannot search products on wp-admin of woocommerce

Scenario: I have my searchbox on my front page of my website. On that searchbox, I can search the product by SKU and product name.

Problem : I can search a product on client's page/Front-end but not on wp-admin of the website.

I already tried this : Woocommerce cannot see products in wp-admin , but still no result found.

Something strange!

Does anybody know?

For the sake of those developers who may also encounter same problem, that's why I want to put it here for future reference.

I have been backtracking and searching answers on the internet but I found none. I tried to review my functions.php inside the theme and found this code below:

 function __search_by_title_only( $search, &$wp_query ) { 
   global $wpdb;
   $entry = isset($_GET['s']) ? $_GET['s'] : '';     
   if(  $entry ){
      $search =  "MY SQL QUERY HERE....."; 
    }        
   return $search;
 }
 add_filter( 'posts_search', '__search_by_title_only', 500, 2 ); 

The above code was inserted inside the functions.php in order to overwrite the query.

posts_search filter, overrrides the product search on my back-end of search though my query was mistaken that's why the problem exists.

I just removed the code and everything works fine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM