Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save desrosj/de6a3923c61f5b4a3046a643e286abab to your computer and use it in GitHub Desktop.
Save desrosj/de6a3923c61f5b4a3046a643e286abab to your computer and use it in GitHub Desktop.
<?php
$posts = array();
$args = array(
'posts_per_page' => 100,
'offset' => 0,
'post_type' => 'post',
'post_status' => 'publish',
);
$my_query = new WP_Query( $args );
while ( $my_query->have_posts() ) {
$posts = array_merge( $posts, $my_query->posts );
$args['offset'] = $args['offset'] + $args['posts_per_page'];
$my_query = new WP_Query( $args );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment