woocommerce_shop_order_search_fields
Searches on meta data can be slow - this lets you choose what fields to search.
3.0.0 added _billing_address and _shipping_address meta which contains all address data to make this faster. This however won't work on older orders unless updated, so search a few others (expand this using the filter if needed).
Использование
add_filter( 'woocommerce_shop_order_search_fields', 'wp_kama_woocommerce_shop_order_search_fields_filter' ); /** * Function for `woocommerce_shop_order_search_fields` filter-hook. * * @param $array * * @return */ function wp_kama_woocommerce_shop_order_search_fields_filter( $array ){ // filter... return $array; }
- $array
- -
Где вызывается хук
woocommerce_shop_order_search_fields
woocommerce/includes/data-stores/class-wc-order-data-store-cpt.php 596-605
apply_filters( 'woocommerce_shop_order_search_fields', array( '_billing_address_index', '_shipping_address_index', '_billing_last_name', '_billing_email', '_billing_phone', ) )