woocommerce_analytics_orderby_enum_(rest_base) хук-фильтрWC 9.4.0

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.

Использование

add_filter( 'woocommerce_analytics_orderby_enum_(rest_base)', 'wp_kama_woocommerce_analytics_orderby_enum_rest_base_filter' );

/**
 * Function for `woocommerce_analytics_orderby_enum_(rest_base)` filter-hook.
 * 
 * @param array $orderby_enum The orderby query parameter enum.
 *
 * @return array
 */
function wp_kama_woocommerce_analytics_orderby_enum_rest_base_filter( $orderby_enum ){

	// filter...
	return $orderby_enum;
}
$orderby_enum(массив)
The orderby query parameter enum.

Список изменений

С версии 9.4.0 Введена.

Где вызывается хук

GenericController::apply_custom_orderby_filters()
woocommerce_analytics_orderby_enum_(rest_base)
woocommerce/src/Admin/API/Reports/GenericController.php 285
return apply_filters( "woocommerce_analytics_orderby_enum_{$this->rest_base}", $orderby_enum );

Где используется хук в WooCommerce

Использование не найдено.