wp network

Perform network-wide operations.

Commands Description
wp network meta list List all metadata associated with an object.
wp network meta get Get meta field value.
wp network meta delete Delete a meta field.
wp network meta add Add a meta field.
wp network meta update Update a meta field.
wp network meta pluck Get a nested value from a meta field.
wp network meta patch Update a nested value for a meta field.

Examples

# Get a list of super-admins
$ wp network meta get 1 site_admins
array (
  0 => 'supervisor',
)

Source code of the commands


wp network meta list

List all metadata associated with an object.

Usage

wp network meta list {id} [--keys={keys}] [--fields={fields}] [--format={format}] [--orderby={fields}] [--order={order}]

You can specify global options and the following:

{id}
ID for the object.
[--keys={keys}]
Limit output to metadata of specific keys.
[--fields={fields}]
Limit the output to specific row fields. Defaults to id,meta_key,meta_value.
[--format={format}]

Render output in a particular format.
Default: table
Can be:

  • table
  • csv
  • json
  • yaml
  • count
[--orderby={fields}]

Set orderby which field.
Default: id
Can be:

  • id
  • meta_key
  • meta_value
[--order={order}]

Set ascending or descending order.
Default: asc
Can be:

  • asc
  • desc

wp network meta get

Get meta field value.

Usage

wp network meta get {id} {key} [--format={format}]

You can specify global options and the following:

{id}
The ID of the object.
{key}
The name of the meta field to get.
[--format={format}]

Get value in a particular format.
Default: var_export
Can be:

  • var_export
  • json
  • yaml

wp network meta delete

Delete a meta field.

Usage

wp network meta delete {id} [{key}] [{value}] [--all]

You can specify global options and the following:

{id}
The ID of the object.
[{key}]
The name of the meta field to delete.
[{value}]
The value to delete. If omitted, all rows with key will deleted.
[--all]
Delete all meta for the object.

wp network meta add

Add a meta field.

Usage

wp network meta add {id} {key} [{value}] [--format={format}]

You can specify global options and the following:

{id}
The ID of the object.
{key}
The name of the meta field to create.
[{value}]
The value of the meta field. If omitted, the value is read from STDIN.
[--format={format}]

The serialization format for the value.
Default: plaintext
Can be:

  • plaintext
  • json

wp network meta update

Update a meta field.

Usage

wp network meta update {id} {key} [{value}] [--format={format}]

You can specify global options and the following:

{id}
The ID of the object.
{key}
The name of the meta field to update.
[{value}]
The new value. If omitted, the value is read from STDIN.
[--format={format}]

The serialization format for the value.
Default: plaintext
Can be:

  • plaintext
  • json

wp network meta pluck

Get a nested value from a meta field.

Usage

wp network meta pluck {id} {key} {key-path}... [--format={format}]

You can specify global options and the following:

{id}
The ID of the object.
{key}
The name of the meta field to get.
{key-path}...
The name(s) of the keys within the value to locate the value to pluck.
[--format={format}]
The output format of the value.
--- Default: plaintext
Can be:
  • plaintext
  • json
  • yaml

wp network meta patch

Update a nested value for a meta field.

Usage

wp network meta patch {action} {id} {key} {key-path}... [{value}] [--format={format}]

You can specify global options and the following:

{action}

Patch action to perform.

Can be:

  • insert
  • update
  • delete
{id}
The ID of the object.
{key}
The name of the meta field to update.
{key-path}...
The name(s) of the keys within the value to locate the value to patch.
[{value}]
The new value. If omitted, the value is read from STDIN.
[--format={format}]

The serialization format for the value.
Default: plaintext
Can be:

  • plaintext
  • json