add_filter( "wpo_custom_product_search", function($do_custom_search,$query_args,$term) { //don't do custom search , just set filter add_filter("posts_where", function($where,$query) { global $wpdb; $custom_conditions = array(); foreach($query->query_vars['search_terms'] as $term) { $like = "%" . $wpdb->esc_like( $term ) . "%"; $custom_conditions[] = "CONCAT({$wpdb->posts}.post_title,{$wpdb->posts}.post_excerpt) LIKE '$like'"; } $custom_where = join( " AND ", $custom_conditions); return $where. " OR " . $custom_where; }, 10, 2); return false; }, 10, 3);
Search product by title and short description Print
Created by: Alex Prokaev
Modified on: Fri, 11 Oct, 2019 at 9:28 AM
Did you find it helpful? Yes No
Send feedbackSorry we couldn't be helpful. Help us improve this article with your feedback.