Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $limit = 200;
- $offset = 0;
- while (TRUE) {
- $posts = new WP_Query(array(
- 'posts_per_page' => $limit,
- 'offset' => $offset,
- 'post_type' => $post_type,
- 'orderby' => 'title',
- 'order' => 'ASC',
- 'post_status' => array('publish', 'private', 'draft', 'inherit'),
- ));
- if (!$posts->have_posts()) break;
- while($posts->have_posts())
- {
- $posts->the_post();
- # do some echoing with the $post
- }
- $offset += $limit;
- } /*(TRUE)*/
- # do some echoing with the $post
- # wipe post from memory
- wp_cache_delete( $post->ID, 'posts' );
- wp_cache_delete( $post->ID, 'post_meta' );
- wp_cache_flush();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement