admin管理员组文章数量:1277397
I'm using below wp-cli
command to get latest post ID:
wp post list --order='DESC' --orderby='ID' --field='ID' | head -1
This, however is inefficient as all posts are retrieved from DB and then head
limits the number of returned posts.
Is there a way to limit the number of returned posts using wp query?
I'm using below wp-cli
command to get latest post ID:
wp post list --order='DESC' --orderby='ID' --field='ID' | head -1
This, however is inefficient as all posts are retrieved from DB and then head
limits the number of returned posts.
Is there a way to limit the number of returned posts using wp query?
Share Improve this question asked Oct 30, 2021 at 11:06 rokpotorokpoto 2243 silver badges14 bronze badges1 Answer
Reset to default 2Simply add:
--posts_per_page=1
to limit the queried items to a single item.
本文标签: wp cliGet last published post in Wordpress using wpcli
版权声明:本文标题:wp cli - Get last published post in Wordpress using wp-cli 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741243611a2364453.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论