Fixe the return type of wc_order_search()

This commit is contained in:
Claudio Sanches 2016-06-13 15:26:14 -03:00
parent b3dbd93df5
commit c9a3ce465f
3 changed files with 3 additions and 3 deletions

View File

@ -1516,7 +1516,7 @@ class WC_Admin_Post_Types {
$post_ids = wc_order_search( $_GET['s'] ); $post_ids = wc_order_search( $_GET['s'] );
if ( is_array( $post_ids ) ) { if ( ! empty( $post_ids ) ) {
// Remove "s" - we don't want to search order name. // Remove "s" - we don't want to search order name.
unset( $wp->query_vars['s'] ); unset( $wp->query_vars['s'] );

View File

@ -431,7 +431,7 @@ class WC_REST_Orders_Controller extends WC_REST_Posts_Controller {
if ( ! empty( $args['s'] ) ) { if ( ! empty( $args['s'] ) ) {
$order_ids = wc_order_search( $args['s'] ); $order_ids = wc_order_search( $args['s'] );
if ( is_array( $order_ids ) ) { if ( ! empty( $order_ids ) ) {
unset( $args['s'] ); unset( $args['s'] );
$args['post__in'] = array_merge( $order_ids, array( 0 ) ); $args['post__in'] = array_merge( $order_ids, array( 0 ) );
} }

View File

@ -993,7 +993,7 @@ function wc_order_search( $term ) {
global $wpdb; global $wpdb;
$term = str_replace( 'Order #', '', wc_clean( $term ) ); $term = str_replace( 'Order #', '', wc_clean( $term ) );
$post_ids = false; $post_ids = array();
// Search fields. // Search fields.
$search_fields = array_map( 'wc_clean', apply_filters( 'woocommerce_shop_order_search_fields', array( $search_fields = array_map( 'wc_clean', apply_filters( 'woocommerce_shop_order_search_fields', array(