Created
February 3, 2015 10:17
-
-
Save tyxla/6245bc6f301463b7aeca to your computer and use it in GitHub Desktop.
get_posts() - recommended usage
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 | |
# 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