Created
May 24, 2016 20:02
-
-
Save desrosj/de6a3923c61f5b4a3046a643e286abab to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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