Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 65928

A generic term referring to the process of retrieving information from a database.

9 votes

How to limit the number of posts that WP_Query gets?

Here is what you need to do $args = array( 'post_type' => 'blog_posts', 'posts_per_page' => '5', ); $query = new WP_Query($args); The above query will return 5 posts of type 'blog_posts … ' , if it is not a custom post type , then just replace like this 'post_type' => 'posts', if you want to fetch all posts then replace like this 'posts_per_page' => '-1', , for more details WP Query
shuvroMithun's user avatar