From 5fb5a7ded2cc0ad6a2a34f6553dd744093f55f14 Mon Sep 17 00:00:00 2001 From: Shiva Poudel Date: Wed, 17 Feb 2016 00:25:06 +0545 Subject: [PATCH] We need to check for ID in array to exclude user ID as search_columns are of different --- includes/class-wc-ajax.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/includes/class-wc-ajax.php b/includes/class-wc-ajax.php index 2ab88f0983e..713004737bc 100644 --- a/includes/class-wc-ajax.php +++ b/includes/class-wc-ajax.php @@ -1983,7 +1983,6 @@ class WC_AJAX { 'fields' => 'all', 'orderby' => 'display_name', 'search' => '*' . $term . '*', - 'exclude' => $exclude, 'search_columns' => array( 'ID', 'user_login', 'user_email', 'user_nicename' ) ) ) ); @@ -1993,7 +1992,9 @@ class WC_AJAX { if ( ! empty( $customers ) ) { foreach ( $customers as $customer ) { - $found_customers[ $customer->ID ] = $customer->display_name . ' (#' . $customer->ID . ' – ' . sanitize_email( $customer->user_email ) . ')'; + if ( ! in_array( $customer->ID, $exclude ) ) { + $found_customers[ $customer->ID ] = $customer->display_name . ' (#' . $customer->ID . ' – ' . sanitize_email( $customer->user_email ) . ')'; + } } }