Skip to content

Instantly share code, notes, and snippets.

@tyxla
Created February 3, 2015 10:17
Show Gist options
  • Save tyxla/6245bc6f301463b7aeca to your computer and use it in GitHub Desktop.
Save tyxla/6245bc6f301463b7aeca to your computer and use it in GitHub Desktop.
get_posts() - recommended usage
<?php
# Recommended usage for get_posts() and other functions with similar querystring parameters
$args = array(
'post_type' => 'attachment',
'posts_per_page' => 5,
'post_status' => 'inherit',
'suppress_filters' => false,
);
$attachments = get_posts($args);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment