Generate a plugin to bulk edit post meta
Editing 200 case studies one by one because a field changed its format is the kind of task nobody plans for but everyone ends up doing. WordPress core "Bulk Edit" only covers built-in fields, and most generic bulk-edit plugins add a full UI that is more than you need.
A dedicated plugin tuned to your post type and your meta fields is the fastest path. You pick the posts, choose a field, preview what changes, and commit.
Why generate it instead of installing an existing plugin?
Admin Columns Pro + Bulk Edit add-on is around €149/year. Great if you do this every week across many fields. Overkill if you need to clean up a specific field once per quarter.
The generated plugin adds a single admin page for your CPT with checkboxes and a field picker limited to the meta keys you actually want to edit. Because the field list is hardcoded to your data model, editors cannot accidentally rewrite a system field.
The preview step is the critical part: we show each affected row with old → new, and commit only after confirmation. For string operations (trim, lowercase, replace), and enum mapping, this prevents the one-way mistakes that Excel-style bulk-edits make so easy.
Example prompt
This is the kind of description that generates this plugin. You can start from it and tweak whatever you need before hitting generate.
Plugin name: Acme Case Meta Tools
Admin page at Tools → Case Meta Tools.
Step 1: pick a filter — all cases, by industry, by year.
Step 2: list matching cases with checkboxes.
Step 3: pick the operation:
- Set field X to value Y.
- Append string to field X.
- Replace regex pattern in field X.
- Map enum: if field X == "old_value" set to "new_value" (multi pair).
Step 4: preview table showing id, title, field, old value → new value for each row. No writes yet.
Step 5: on "Commit", writes happen in a batched transaction (chunks of 50), with a progress bar, and an audit log row per change.
Audit log stored in wp_acme_meta_audit with old/new/user/timestamp. Visible from the admin, last 500 entries.What the generated plugin typically includes
- Admin page scoped to a CPT and an allowed meta-key list
- Filterable post list with checkboxes
- Operation picker (set / append / regex replace / enum map)
- Preview diff before write
- Batched commit with progress bar to handle 1000+ rows
- Audit log table with old/new values and the user who did it
CPT, allowed fields, and operations are defined in the prompt. For "write never happens without a preview" to be strict, the preview is generated server-side, not just from the selected checkboxes.
Frequently asked questions
Can I undo?
The audit log keeps old values, and the plugin ships an "Undo batch X" button that restores the previous state for a given batch id.
What about performance on 10k+ posts?
Operations run in chunks of 50 with sleep 100ms between chunks to avoid locking. The progress bar updates over REST.