woof_meta_data_datapicker
Filters the meta query array generated for a datepicker meta filter, allowing modification of the date range query parameters before they are applied to the product query.
Parameters
$meta (array) — The meta query array with keys: key, value, type, compare — or empty array if no valid range is determined
$meta_key (string) — The meta key name for the custom field being filtered
Source File
ext/meta_filter/html_types/datepicker/index.php:149
Code Example
add_filter('woof_meta_data_datapicker', function($meta, $meta_key) {
// Extend the date range by 1 day on each side
if (!empty($meta) && isset($meta['value'])) {
$meta['value'][0] = strtotime('-1 day', $meta['value'][0]);
$meta['value'][1] = strtotime('+1 day', $meta['value'][1]);
}
return $meta;
}, 10, 2);
Usage Notes
- When ACF date format is active (woof_meta_use_acf_dateformat filter), dates are formatted as Ymd.
- Supports various compare modes: BETWEEN, >, < depending on which range values are set.
- The 'i' sentinel value is used to represent 'infinity' (no boundary).