Я использую цикл wordpress WP_Query, который нужно фильтровать на определенный диапазон дат.filter post_where using minutes
соответственно я поставил следующий фильтр, чтобы показать все сообщения более чем на 10 дней:
//Create a filter that only shows posts for a certain time frame
function restrict_posts_by_date_10($where = '') {
global $wpdb;
$where .= " AND post_date <= '" . date('Y-m-d', strtotime('-10 days')) . "'";
return $where;
}
add_filter('posts_where', 'restrict_posts_by_date_10');
Для тестирования я не могу ждать несколько дней для остальной части действия огня, так что я хотел бы чтобы установить это на 2 минуты. Однако следующее не работает
//Create a filter that only shows posts for a certain time frame
function restrict_posts_by_date_10($where = '') {
global $wpdb;
$where .= " AND post_date <= '" . date('Y-m-d', strtotime('-2 minutes')) . "'";
return $where;
}
add_filter('posts_where', 'restrict_posts_by_date_10');
Любые идеи были бы замечательными.
Приветствия