WP-CLI can’t list posts

I have a WordPress Multisite (behind a firewall). I use WP-CLI for lots of things. But for some reason wp post list does not work. wp post get works. But wp post list always yields the same output, like this:

screenshot of post list output

As you can see, it’s a table with no data. Does anyone have tips for debugging this issue?

As requested, I reformatted the command (made no difference) and added –debug. There is a lot of output!

enter image description here

Added post_type=page:
enter image description here

1 Answer
1

(I’ll post here @photocurio’s answer, as it’s hidden in the comments)

wp post list --post_type=page      # will show only post-type=page
wp post list                       # will show only post-type=post

It’s counter-intuitive command is also mis-documented, (which I hope to change), because:

  1. pages are posts.
  2. There’s no “wp page list” command.
  3. The docs don’t mention that the list is filtered by default

I’d naturally expect that a query will be inclusive by default, so I was surprised not to find a page list in wp-cli’s docs.

Leave a Comment