Clean Up Leftover Multi-Meta
CLI command to resolve a potential issue with outdated DB values for registered meta
by kadamwhite · github.com/kadamwhite/clean-up-leftover-multi-meta
★ 1stars
269composer installs
0forks
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/kadamwhite/clean-up-leftover-multi-meta/archive/refs/heads/main.zipAlso on Packagist as humanmade/clean-up-leftover-multi-meta:
composer require humanmade/clean-up-leftover-multi-metaFrom the readme
Clean up leftover multi-meta
There is a potential bug in the REST API (identified by @MiguelAxcarHM, and being discussed between @TimothyBJacobs and @kadamwhite here in WordPress core Slack) where updates to meta values can fail unexpectedly because of unrelated other meta.
Our working theory is that this happens when a meta key is registered (using registermeta or registerpostmeta) with 'single' = true, but that meta key still has multiple rows in the database as you would expect if it was previously used as 'single' = false. For example,
This plugin provides a CLI command which can be used to iterate through all posts of a post type, check for registered meta for that post, and identify whether any single-registered meta keys have duplicated rows in the postmeta table. The duplicated meta IDs are then cleaned out.
If a meta key has multiple rows for a post with different values, we should leave those alone.
Example command:
Read the full README on GitHub →
Releases
| Tag | Published |
|---|---|
| v0.1.0 | Sep 26, 2022 |
These releases are tags only. The author does not attach a packaged zip, so there are no download counts to report.