Automattic / custom-metadata

A WordPress plugin that provides an easy way to add custom fields to your object types (post, pages, custom post types, users)
https://wordpress.org/plugins/custom-metadata/
192 stars 46 forks source link

saves post meta for post revisions #123

Closed leedo closed 6 years ago

leedo commented 9 years ago

I'm not sure if this is intentional, but I recently noticed that our post meta table was full of rows that were tied to post revision IDs. This plugin seems to be the source of that.

When saving a post, often times the save_post action gets called twice. Once with a revision ID, and once with the real post ID. So this plugin ends up updating two sets of post meta values, and the meta tied to the revision IDs are never used for anything as far as I can tell.

I think the save_post_meta function should call wp_is_post_revision on the post ID, and if it is true, return early. This is what is done for autosaves already.