最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

multisite - WP-CLI can't list posts

programmeradmin2浏览0评论

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:

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!

Added post_type=page:

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:

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!

Added post_type=page:

Share Improve this question edited Jun 3, 2019 at 20:08 photocurio asked May 30, 2019 at 15:46 photocuriophotocurio 761 silver badge7 bronze badges 6
  • I'd always put the --url option at the end. wp post list --url=https://example/foobar. Next add the --debug option. Can you please edit your question and post the debug output as well? – norman.lol Commented Jun 1, 2019 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 Commented Jun 3, 2019 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? – norman.lol Commented Jun 3, 2019 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 Commented Jun 3, 2019 at 20:06
  • That's really odd. And wp post get is really working? – norman.lol Commented Jun 4, 2019 at 11:10
 |  Show 1 more comment

1 Answer 1

Reset to default 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.

发布评论

评论列表(0)

  1. 暂无评论