Fixe the return type of wc_order_search()
This commit is contained in:
parent
b3dbd93df5
commit
c9a3ce465f
|
@ -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'] );
|
||||||
|
|
||||||
|
|
|
@ -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 ) );
|
||||||
}
|
}
|
||||||
|
|
|
@ -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(
|
||||||
|
|
Loading…
Reference in New Issue