WordPress get posts by date without query_posts
Yes, simple add a filter before you call it and remove it after you do function filter_where_wpa89154($where=””) { //posts in the last 30 days $where .= ” AND post_date > ‘” . date(‘Y-m-d’, strtotime(‘-30 days’)) . “‘”; return $where; } add_filter(‘posts_where’, ‘filter_where_wpa89154’); $args = array( ‘posts_per_page’ => 5, ‘post_type’ => ‘post’, ‘post_status’ => ‘publish’, ‘suppress_filters’ … Read more