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

  • I'd always put the --url option at the end. wp post list --url=https://example.com/foobar. Next add the --debug option. Can you please edit your question and post the debug output as well?
    – leymannx
    Jun 1 '19 at 16:07
  • I didn't know about --debug. I'd paste the output, but it's 6000 characters too long. I can make a screenshot I guess.
    – photocurio
    Jun 3 '19 at 2:25
  • Thank you! Everything looks good so far. What does wp post list --post_type=page return? And your site is among wp site list, yes?
    – leymannx
    Jun 3 '19 at 5:48
  • Its about the same if I add the --post_type=page parameter. Yes, wp site list returns all sites, and /home-therapies/ is on the list.
    – photocurio
    Jun 3 '19 at 20:06
  • That's really odd. And wp post get is really working?
    – leymannx
    Jun 4 '19 at 11:10

(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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.