Wp-cli: Using --post_author with wp post list doesn't work

Created on 23 Jun 2016  路  2Comments  路  Source: wp-cli/wp-cli

wp post list --post_type=page --post_author=987654321
Returns results from all authors

wp post list --post_type=page --author=987654321
Returns results from the given author

Looks like just a naming convention thing ... ie docs at https://wp-cli.org/commands/post/list/ say the field is supposed to be post_author. --post_author works properly on things like wp post create and wp post update, and obviously the column is post_author too.

Just luck that i stumbled on --author working!

post-list unconfirmed

Most helpful comment

Ouch, this naming difference took me for a spin for a good minute.

All 2 comments

Looks like just a naming convention thing ... ie docs at https://wp-cli.org/commands/post/list/ say the field is supposed to be post_author.

The field that is returned in the Post object is post_author. author is one of the supported WP_Query parameters. The "Options" section to the documentation includes:

[--<field>=<value>]
   One or more args to pass to WP_Query.

The fact that there's a slight difference is something we'll be reconciling with the RESTful WP-CLI project https://github.com/danielbachhuber/wp-rest-cli

Ouch, this naming difference took me for a spin for a good minute.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tillkruss picture tillkruss  路  3Comments

JOduMonT picture JOduMonT  路  3Comments

mirzazeyrek picture mirzazeyrek  路  3Comments

NateWr picture NateWr  路  3Comments

sir-gon picture sir-gon  路  4Comments