woof_get_request_data
woof_get_request_data
Позволяет модифицировать данные поискового запроса перед их обработкой. Используется для добавления своих параметров фильтрации.
Parameters
$data (array) — массив данных запроса
Source File
index.php
Code Example
add_filter('woof_get_request_data', function($data) {
// Add custom filter parameter programmatically
if (!isset($data['min_price']) AND isset($_GET['custom_min'])) {
$data['min_price'] = floatval($_GET['custom_min']);
}
if (!isset($data['max_price']) AND isset($_GET['custom_max'])) {
$data['max_price'] = floatval($_GET['custom_max']);
}
return $data;
});
Usage Notes
- Add this code to your theme's
functions.phpfile or a custom plugin. - The hook is applied during the filtering process — changes take effect immediately.
- Always return the expected value type from the callback function.