Updating post meta at scale requires PHP
You want to add a featured_on_homepage flag to 50 posts matching a pattern. WordPress's Custom Fields UI lets you do one post at a time. For bulk, you're back to update_post_meta() in PHP, which means writing a script, running it once, then deleting it.
Worse, update_post_meta has no safety net. Typo a key like _edit_lock and you can corrupt post storage. Typo _wp_page_template and you break the template assignment.
What most people do instead
A better way: one command, protected keys blocked
Run update post meta with -post_id, -meta_key, and -meta_value. Inside a macro, loop over filter-post results with for_each. Protected keys (_edit_lock, _wp_page_template, _wp_attached_file) are blocked, so a typo can't corrupt post storage.
Shown in advanced mode, where commands start with tp. In easy mode you type the same command without the tp prefix.
Safety rail baked in. Protected keys (_edit_lock, _wp_page_template, _wp_attached_file, _wp_trash_meta_time) are blocked. A macro accidentally pointed at a protected key fails gracefully instead of corrupting the post.
How it works
Wraps update_post_meta with validation. If -post_id is omitted, uses the current post context (when available). Protected keys return an error before the meta write happens.
| Parameter | Value |
|---|---|
-post_id | Target post ID. Empty uses current post context. |
-meta_key (required) | Meta key (not a protected core key) |
-meta_value (required) | Meta value (string, number, or serialized data) |
| Protected keys | _edit_lock, _edit_last, _wp_page_template, _wp_attached_file, and others, blocked |
| Can be used in |
Real example
You launched a new SEO strategy. Every post over 2000 words should get a seo_long_form flag so your theme template can render a table of contents for them.
Macro: tp filter post -status=publish -min_length=2000 → for_each: tp update post meta -meta_key=seo_long_form -meta_value=1. One run flags every long-form post. Your theme template renders TOCs from the flag without you touching a single post.
Goes further with TrueCommander
Frequently asked questions
update_post_meta() snippet or opening the database, run tp update post meta -post_id=123 -meta_key=_seo_title -meta_value="New title". It creates the field if it does not exist, or updates it if it does._edit_lock, _wp_page_template, and _wp_attached_file are blocked, so you cannot corrupt core post storage by accident.