简体   繁体   中英

WP_Query default number of posts

Is that true that WP_Query by default returns 10 posts? I have more than 10 posts and didn't set the post_count variable and it returned 10 posts. Then I set post_count to 1000 and it returned all posts (Now I have 27 posts for test purposes). Then I read some documentation and learned from there that I can set post_count=-1 to return all posts. I tried and it worked. But I couldn't find an explanation if it's fine that it returns 10 posts by default. Thanks.

Yes, the default is 10 posts. You should have a look at the documentation for The Loop. That will help you get a better understanding of how this works.

http://codex.wordpress.org/The_Loop

Yes. The default number of posts is 10.

The easiest way to change this is in Settings after logging in Wordpress administrator.

You will see: Maximum number of posts to show in this site: 10

Change it !! And the maximun numbers of feeds if you want.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM