woocommerce_orders_table_query_sql filter-hookWC 7.9.0

Filters the completed SQL query.

Note: queries left unmodified by this filter may later be rewritten for performance (see OrdersTableStatusUnionQuery), in which case the SQL received here is not the SQL that ends up being executed. Returning a modified query from this filter disables any such rewrite.

Usage

add_filter( 'woocommerce_orders_table_query_sql', 'wp_kama_woocommerce_orders_table_query_sql_filter' );

/**
 * Function for `woocommerce_orders_table_query_sql` filter-hook.
 * 
 * @param string $sql The complete SQL query.
 *
 * @return string
 */
function wp_kama_woocommerce_orders_table_query_sql_filter( $sql ){

	// filter...
	return $sql;
}
$sql(string)
The complete SQL query.

Changelog

Since 7.9.0 Introduced.

Where the hook is called

OrdersTableQuery::build_query()
woocommerce_orders_table_query_sql
woocommerce/src/Internal/DataStores/Orders/OrdersTableQuery.php 929
$filtered_sql = apply_filters_ref_array( 'woocommerce_orders_table_query_sql', array( $this->sql, &$this, $this->args ) );

Where the hook is used in WooCommerce

Usage not found.