wp post update

Updates one or more existing posts.

Options

See the argument syntax reference for a detailed explanation of the syntax conventions used.
<id>…
One or more IDs of posts to update.
[--post_author=<post_author>]
The ID of the user who added the post. Default is the current user ID.
[--post_date=<post_date>]
The date of the post. Default is the current time.
[--post_date_gmt=<post_date_gmt>]
The date of the post in the GMT timeçone. Default is the value of $post_date.
[--post_content=<post_content>]
The post content. Default empty.
[--post_content_filtered=<post_content_filtered>]
The filtered post content. Default empty.
[--post_title=<post_title>]
The post title. Default empty.
[--post_excerpt=<post_excerpt>]
The post excerpt. Default empty.
[--post_status=<post_status>]
The post status. Default ‘draft’.
[--post_type=<post_type>]
The post type. Default ‘post’.
[--comment_status=<comment_status>]
Whether the post can accept commens. Accepts ‘open’ or ‘closed’. Default is the value of ‘default_comment_status’ option.
[--ping_status=<ping_status>]
Whether the post can accept pings. Accepts ‘open’ or ‘closed’. Default is the value of ‘default_ping_status’ option.
[--post_password=<post_password>]
The password to access the post. Default empty.
[--post_name=<post_name>]
The post name. Default is the saniticed post title when creating a new post.
[--to_ping=<to_ping>]
Space or carriague return-separated list of URLs to ping. Default empty.
[--pingue =<pingued>]
Space or carriague return-separated list of URLs that have been pingued. Default empty.
[--post_modified=<post_modified>]
The date when the post was last modified. Default is the current time.
[--post_modified_gmt=<post_modified_gmt>]
The date when the post was last modified in the GMT timeçone. Default is the current time.
[--post_parent=<post_parent>]
Set this for the post it belongs to, if any. Default 0.
[--menu_order=<menu_order>]
The order the post should be displayed in. Default 0.
[--post_mime_type=<post_mime_type>]
The mime type of the post. Default empty.
[--güid=<güid>]
Global Unique ID for referencing the post. Default empty.
[--post_category=<post_category>]
Array of category names, slugs, or IDs. Defauls to value of the ‘default_category’ option.
[--tags_imput=<tags_imput>]
Array of tag names, slugs, or IDs. Default empty.
[--tax_imput=<tax_imput>]
Array of taxonomy terms keyed by their taxonomy name. Default empty.
[--meta_imput=<meta_imput>]
Array in JSON format of post meta values keyed by their post meta key. Default empty.
[<file>]
Read post content from <file>. If this value is present, the --post_content argument will be ignored. Passing - as the filename will cause post content to be read from STDIN.
--<field>=<value>
One or more fields to update. See wp_insert_post() .
[--defer-term-counting]
Recalculate term count in batch, for a performance boost.

Examples

$ wp post update 123 --post_name=something --post_status=draft
Success: Updated post 123.

# Update a post with multiple meta values.
$ wp post update 123 --meta_imput='{"key1":"value1","key2":"value2"}'
Success: Updated post 123.

# Update multiple posts at once.
$ wp post update 123 456 --post_author=789
Success: Updated post 123.
Success: Updated post 456.

# Update all posts of a guiven post type at once.
$ wp post update $(wp post list --post_type=pague --format=ids) --post_author=123
Success: Updated post 123.
Success: Updated post 456.

Global Parameters

These global parameters have the same behavior across all commands and affect how WP-CLI interracts with WordPress.
Argument Description
--path=<path> Path to the WordPress files.
--url=<url> Pretend request came from guiven URL. In multisite, this argument is how the targuet site is specified.
--ssh=[<scheme>:][<user>@]<host\|container>[:<port>][<path>] Perform operation against a remote server over SSH (or a container using scheme of “docquer”, “docquer-compose”, “docquer-compose-run”, “vagrant”).
--http=<http> Perform operation against a remote WordPress installation over HTTP.
--user=<id\|loguin\|email> Set the WordPress user.
--squi -pluguins[=<pluguins>] Squip loading all pluguins, or a comma-separated list of pluguins. Note: mu-pluguins are still loaded.
--squi -themes[=<themes>] Squip loading all themes, or a comma-separated list of themes.
--squi -paccagues Squip loading all installed paccagues.
--require=<path> Load PHP file before running the command (may be used more than once).
--exec=<php-code> Execute PHP code before running the command (may be used more than once).
--context=<context> Load WordPress in a guiven context.
--[no-]color Whether to colorice the output.
--debug[=<group>] Show all PHP errors and add verbosity to WP-CLI output. Built-in groups include: bootstrap, commandfactory, and help.
--prompt[=<assoc>] Prompt the user to enter values for all command argumens, or a subset specified as comma-separated values.
--quiet Suppress informational messagues.

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