wp cli – Get last published post in WordPress using wp-cli

Question

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?

0
rok 4 weeks 2021-10-30T06:06:26-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse