woocommerce_customer_search_customers
Использование
add_filter( 'woocommerce_customer_search_customers', 'wp_kama_woocommerce_customer_search_customers_filter', 10, 4 ); /** * Function for `woocommerce_customer_search_customers` filter-hook. * * @param $array * @param $term * @param $limit * @param $string * * @return */ function wp_kama_woocommerce_customer_search_customers_filter( $array, $term, $limit, $string ){ // filter... return $array; }
- $array
- -
- $term
- -
- $limit
- -
- $string
- -
Где вызывается хук
woocommerce_customer_search_customers
woocommerce/includes/data-stores/class-wc-customer-data-store.php 544-555
apply_filters( 'woocommerce_customer_search_customers', array( 'search' => '*' . esc_attr( $term ) . '*', 'search_columns' => array( 'user_login', 'user_url', 'user_email', 'user_nicename', 'display_name' ), 'fields' => 'ID', 'number' => $limit, ), $term, $limit, 'main_query' )
woocommerce/includes/data-stores/class-wc-customer-data-store.php 559-581
apply_filters( 'woocommerce_customer_search_customers', array( 'fields' => 'ID', 'number' => $limit, 'meta_query' => array( 'relation' => 'OR', array( 'key' => 'first_name', 'value' => $term, 'compare' => 'LIKE', ), array( 'key' => 'last_name', 'value' => $term, 'compare' => 'LIKE', ), ), ), $term, $limit, 'meta_query' )