wp post update
Overview
Modify any field on an existing post — title, content, status, author, date, and more. Accepts one or more post IDs, enabling bulk updates in a single command.
What It Does
wp post update calls wp_update_post() on the specified post(s). You can update any post field that wp_insert_post() accepts.
Syntax
wp post update <id>... [--<field>=<value>]
Common Options
| Flag | Description |
|---|---|
--post_title=TITLE | New title |
--post_content=CONTENT | New body content |
--post_status=STATUS | publish, draft, trash, private, pending |
--post_author=ID | New author user ID |
--post_date=DATE | New date: YYYY-MM-DD HH:MM:SS |
--post_name=SLUG | New URL slug |
--post_parent=ID | New parent post ID |
--comment_status=STATUS | open or closed |
--ping_status=STATUS | open or closed |
Basic Usage
Update a post's status
wp post update 42 --post_status=publish
Change the title and slug
wp post update 42 --post_title="Updated Title" --post_name="updated-title"
Bulk update — publish multiple drafts
wp post update 12 15 22 --post_status=publish
Update content from a file
wp post update 42 /path/to/new-content.html
Real-World Scenarios
Scenario 1: Publish all pending posts
for id in $(wp post list --post_status=pending --post_type=post --field=ID); do
wp post update "$id" --post_status=publish
done
Scenario 2: Bulk reassign author
# Reassign all posts from author 5 to author 1
for id in $(wp post list --author=5 --field=ID --post_status=any); do
wp post update "$id" --post_author=1
done
Scenario 3: Close comments on old posts
# Close comments on posts older than 2024
for id in $(wp post list --post_type=post --after=2000-01-01 --before=2024-01-01 --field=ID); do
wp post update "$id" --comment_status=closed
done
Scenario 4: Change post date for scheduled content
wp post update 88 --post_date="2026-04-01 09:00:00" --post_status=future
Best Practices
- Always verify IDs with
wp post listbefore bulk updates. - Back up first —
wp db export— before bulk status changes. - Use
wp post list --fields=ID,post_title,post_statusto preview what you'll update.
Quick Reference
wp post update <id> --post_status=publish
wp post update <id> --post_title="New Title"
wp post update 12 15 22 --post_status=publish # Bulk
wp post update <id> --post_author=<user_id>
Next Steps
wp post get— check current field values before updating.wp post meta— update custom meta fields.wp post list— find posts to update.