Skip to content

Instantly share code, notes, and snippets.

@delputnam
Created May 20, 2013 18:36
Show Gist options
  • Save delputnam/5614269 to your computer and use it in GitHub Desktop.
Save delputnam/5614269 to your computer and use it in GitHub Desktop.
Get all WordPress posts of a certain type that have been published.
$query = new WP_Query( array(
'post_type' => 'event_type',
'post_status' => 'publish',
'nopaging' => true
) );
while ( $query->have_posts() ) : $query->the_post();
// Do something with the post here...
endwhile;
wp_reset_postdata();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment