Query Posts by date range with fixed beginning and end
You should probably add the filter, then use a new query, then remove the filter. function filter_where( $where ) { $where .= ” AND post_date >= ‘2012-03-01’ AND post_date <= ‘2014-03-01′”; return $where; } add_filter( ‘posts_where’, ‘filter_where’ ); $query = new WP_Query( array( ‘post_type’ => ‘shop_order’ ) ); while( $query->have_posts() ) : $query->the_post(); the_title(); the_content(); … Read more