wp post <command>

Manages posts, content, and meta.

In this article

Examples

# Create a new post.
$ wp post create --post_type=post --post_title='A sample post'
Success: Created post 123.

# Update an existing post.
$ wp post update 123 --post_status=draft
Success: Updated post 123.

# Delete an existing post.
$ wp post delete 123
Success: Trashed post 123.

Subcommands

NameDescription
wp post create

Creates a new post.

wp post delete

Deletes an existing post.

wp post edit

Launches system editor to edit post content.

wp post exists

Verifies whether a post exists.

wp post generate

Generates some posts.

wp post get

Gets details about a post.

wp post list

Gets a list of posts.

wp post meta

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

wp post term

Adds, updates, removes, and lists post terms.

wp post update

Updates one or more existing posts.

wp post url-to-id

Gets the post ID for a given URL.

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.