Automattic\WooCommerce\Admin\API\Reports
GenericController::apply_custom_orderby_filters
Apply a filter for custom orderby enum.
Method of the class: GenericController{}
Hooks from the method
Returns
Array. An array of filtered orderby enum options.
Usage
// protected - for code of main (parent) or child class $result = $this->apply_custom_orderby_filters( $orderby_enum );
- $orderby_enum(array) (required)
- An array of orderby enum options.
Changelog
| Since 9.4.0 | Introduced. |
GenericController::apply_custom_orderby_filters() GenericController::apply custom orderby filters code WC 10.5.0
protected function apply_custom_orderby_filters( $orderby_enum ) {
/**
* Filter orderby query parameter enum.
*
* There was an initial concern about potential SQL injection with the custom orderby.
* However, testing shows it is safely blocked by validation in the controller,
* which results in an "Invalid parameter(s): orderby" error.
*
* Additionally, it's the responsibility of the merchant/developer to ensure the custom orderby is valid,
* or a WordPress database error will occur for unknown columns.
*
* @since 9.4.0
*
* @param array $orderby_enum The orderby query parameter enum.
*/
return apply_filters( "woocommerce_analytics_orderby_enum_{$this->rest_base}", $orderby_enum );
}