Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Improve code as per feedback
  • Loading branch information
BhargavBhandari90 committed Feb 26, 2025
commit b6fe339fad4dede5d85f70c38b465c2918a66020
12 changes: 3 additions & 9 deletions src/WP_CLI/CommandWithMeta.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,8 @@ function ( $a, $b ) use ( $orderby, $order ) {
* <key>
* : The name of the meta field to get.
*
* [--is-single=<is-single>]
* [--single]
* : Whether to return a single value. This parameter has no effect if $key is not specified.
Comment thread
ernilambar marked this conversation as resolved.
Outdated
* ---
* default: 1
* options:
* - 1
* - 0
* ---
*
* [--format=<format>]
* : Get value in a particular format.
Expand All @@ -165,9 +159,9 @@ public function get( $args, $assoc_args ) {
list( $object_id, $meta_key ) = $args;

$object_id = $this->check_object_id( $object_id );
$is_single = isset( $assoc_args['is-single'] ) ? $assoc_args['is-single'] : 1;
$single = Utils\get_flag_value( $assoc_args, 'single', true );

$value = $this->get_metadata( $object_id, $meta_key, $is_single );
$value = $this->get_metadata( $object_id, $meta_key, $single );

if ( '' === $value ) {
die( 1 );
Expand Down