wp post meta <command>

Adds, updates, deletes, and lists post custom fields.

In this article

Examples

# Set post meta
$ wp post meta set 123 _wp_page_template about.php
Success: Updated custom field '_wp_page_template'.

# Get post meta
$ wp post meta get 123 _wp_page_template
about.php

# Update post meta
$ wp post meta update 123 _wp_page_template contact.php
Success: Updated custom field '_wp_page_template'.

# Delete post meta
$ wp post meta delete 123 _wp_page_template
Success: Deleted custom field.

Subcommands

NameDescription
wp post meta add

Add a meta field.

wp post meta clean-duplicates

Cleans up duplicate post meta values on a post.

wp post meta delete

Delete a meta field.

wp post meta get

Get meta field value.

wp post meta list

List all metadata associated with an object.

wp post meta patch

Update a nested value for a meta field.

wp post meta pluck

Get a nested value from a meta field.

wp post meta update

Update a meta field.

Command documentation is regenerated at every release. To add or update an example, please submit a pull request against the corresponding part of the codebase.