From 8bde3c0f9f471c765a010f9fa958dce9736b3ff9 Mon Sep 17 00:00:00 2001 From: scribu Date: Thu, 1 Aug 2013 03:43:46 +0300 Subject: [PATCH] don't return 'filter' object in `wp post get --format=json` it's a transient value, not actual data --- php/commands/post.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/php/commands/post.php b/php/commands/post.php index 8ef3c727..f368f7ba 100644 --- a/php/commands/post.php +++ b/php/commands/post.php @@ -37,7 +37,7 @@ class Post_Command extends \WP_CLI\CommandWithDBObject { } if ( isset( $assoc_args['edit'] ) ) { - $input = ( isset( $assoc_args['post_content'] ) ) ? + $input = isset( $assoc_args['post_content'] ) ? $assoc_args['post_content'] : ''; if ( $output = $this->_edit( $input, 'WP-CLI: New Post' ) ) @@ -116,7 +116,9 @@ class Post_Command extends \WP_CLI\CommandWithDBObject { break; case 'json': - WP_CLI::print_value( $post, $assoc_args ); + $fields = get_object_vars( $post ); + unset( $fields['filter'] ); + WP_CLI::print_value( $fields, $assoc_args ); break; default: -- 2.11.0