Automattic\WooCommerce\Admin\API
Products::add_wp_query_fields()
Add in conditional select fields to the query.
Метод класса: Products{}
Хуков нет.
Возвращает
Строку
.
Использование
$result = Products::add_wp_query_fields( $select, $wp_query );
- $select(строка) (обязательный)
- Select clause used to select fields from the query.
- $wp_query(объект) (обязательный)
- WP_Query object.
Код Products::add_wp_query_fields() Products::add wp query fields WC 9.4.2
public static function add_wp_query_fields( $select, $wp_query ) { if ( $wp_query->get( 'low_in_stock' ) ) { $fields = array( 'low_stock_amount_meta.meta_value AS low_stock_amount', 'MAX( product_lookup.date_created ) AS last_order_date', ); $select .= ', ' . implode( ', ', $fields ); } return $select; }