wp-metadata-api
Installation
SKILL.md
WordPress Metadata API
Choose the correct metadata surface and preserve its historical contracts. This skill covers correctness and data integrity, not whether a meta table is the right storage primitive for a new feature.
Choose the operation by identity
| Intent | API |
|---|---|
| Read one key's first value | get_post_meta( $id, $key, true ) |
| Read all rows for one key | get_post_meta( $id, $key, false ) |
| Add another row | add_post_meta() / add_metadata() |
| Update every row matching object + key | update_post_meta() / update_metadata() without $prev_value |
| Update only rows matching an old value | pass $prev_value |
| Update one physical row | update_metadata_by_mid() |
| Delete every row matching object + key | delete_post_meta() / delete_metadata() without value |
| Delete one physical row | delete_metadata_by_mid() |