WordPress args
Following are common arguments that may be passed to get_posts() query.
Array | Parameter |
---|---|
posts_per_page | Number of posts displayed per page |
offset | If you have your blog configured to show just one post on the front page, but also want to list links to the previous five posts in category ID 1, you can use this: |
category | ID of Category |
orderby | Sort retrieved posts by parameter. Defaults to ‘date’. One or more options can be passed.
|
order |
Designates the ascending or descending order of the ‘orderby’ parameter. Defaults to ‘DESC’.
|
include | ID of posts with comma like (4,6,3,9) |
exclude | ID of posts with comma like (4,6,3,9) |
meta_key |
Default: None |
meta_value |
Default: None |
post_type | array(‘videos’,’image’,’audio’) |
post_mime_type |
Default: None |
post_parent |
Default: ‘0’ |
post_status |
Default: ‘any’ |
suppress_filters | ‘suppress_filters’ => true as default, while query_posts() applies filters by default, this can be confusing when using query-modifying plugins, like WPML. Also note that even if ‘suppress_filters’ is true, any filters attached to pre_get_posts are still applied—only filters attached on ‘posts_*’ or ‘comment_feed_*’ are suppressed. |