简体   繁体   English

WP_Query默认帖子数

[英]WP_Query default number of posts

Is that true that WP_Query by default returns 10 posts? 缺省情况下,WP_Query返回10个帖子是否正确? I have more than 10 posts and didn't set the post_count variable and it returned 10 posts. 我有10多个帖子,并且没有设置post_count变量,它返回了10个帖子。 Then I set post_count to 1000 and it returned all posts (Now I have 27 posts for test purposes). 然后我将post_count设置为1000,它返回了所有帖子(现在我有27个帖子用于测试目的)。 Then I read some documentation and learned from there that I can set post_count=-1 to return all posts. 然后,我阅读了一些文档,并从那里了解到可以将post_count = -1设置为返回所有帖子。 I tried and it worked. 我尝试了,它起作用了。 But I couldn't find an explanation if it's fine that it returns 10 posts by default. 但是我找不到解释,因为默认情况下它返回10个帖子是可以的。 Thanks. 谢谢。

Yes, the default is 10 posts. 是的,默认值为10个帖子。 You should have a look at the documentation for The Loop. 您应该查看The Loop的文档。 That will help you get a better understanding of how this works. 这将帮助您更好地了解其工作原理。

http://codex.wordpress.org/The_Loop http://codex.wordpress.org/The_Loop

Yes. 是。 The default number of posts is 10. 默认帖子数为10。

The easiest way to change this is in Settings after logging in Wordpress administrator. 更改此设置的最简单方法是在登录Wordpress管理员后在“设置”中。

You will see: Maximum number of posts to show in this site: 10 您将看到:此网站上显示的帖子数上限:10

Change it !! 更改 !! And the maximun numbers of feeds if you want. 以及如果需要的最大提要数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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