WordPress.org

Make WordPress Core

Opened 20 months ago

Closed 20 months ago

Last modified 20 months ago

#43685 closed defect (bug) (invalid)

wp post meta missing options

Reported by: apb1963 Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: General Keywords:
Focuses: Cc:
PR Number:

Description (last modified by ocean90)

Not sure if this is the right place, however...

The following command needs an option that eliminates the ASCII graphics, such as a --porcelain option, and/or --field option (singular). Only --fields (plural) is valid and brings the graphics with it. --format=ids is also missing/broken.

In short, in the following example, I need the output of the wp post meta list to be "168", without quotes - nothing more, nothing less.

wp post meta list 203 --keys=_thumbnail_id --field=meta_value
Error: Parameter errors:
 unknown --field parameter
Did you mean '--fields'?

wp post meta list 203 --keys=_thumbnail_id --fields=meta_value
+------------+
| meta_value |
+------------+
| 168        |
+------------+

wp post meta list 203 --keys=_thumbnail_id --fields=meta_value --format=ids
PHP Catchable fatal error:  Object of class stdClass could not be converted to string in phar:///data/local/bin/wp/php/WP_CLI/Formatter.php on line 139
Catchable fatal error: Object of class stdClass could not be converted to string in phar:///data/local/bin/wp/php/WP_CLI/Formatter.php on line 139

Change History (2)

#1 @ocean90
20 months ago

  • Description modified (diff)
  • Focuses administration removed
  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed
  • Version 4.9.4 deleted

Hello @apb1963, welcome to WordPress Trac!

This Trac is used for enhancements and bug reporting for the WordPress core software. For WP-CLI please take a look at http://wp-cli.org/#support. Thanks!

#2 @johnbillion
20 months ago

By the way, you probably want wp post meta get 203 _thumbnail_id which will give you just the meta field value.

Note: See TracTickets for help on using tickets.