delete_post_meta not working correctly when used with save_post
|Reported by:||studiograsshopper||Owned by:|
I think this is a bug because the same code works fine in 2.9.2.
I'm using add_metabox hooked to admin_menu to manage certain custom fields in the Post and Page Editor. A further function, hooked to save_post, gathers the $_POST items from my metabox, sanitises the data and then adds, updates or deletes postmeta using add_post_meta(), update_post_meta() and delete_post_meta() as required. If a metabox is empty, eg when the user blanks out a metabox field, the function uses this:
to delete the postmeta meta_key from the db where the meta_value is empty.
The problem is that delete_post_meta() is no longer working under the latest nightly build (but works fine in WP 2.9.2). No errors are thrown, but the postmeta meta_key is not removed from the db.
As mentioned, this same code works perfectly on WP 2.9.2. I did a search on trac to see if I could find any tickets relating to this, but either my searching was ineffective, or no one else has reported this.
add_post_meta() and update_post_meta() work as expected.
This bug affects several plugins and themes which use this kind of functionality.
For the sake of completeness, I've attached one of the files from a plugin of mine which is affected by this.
Change History (7)
- Component changed from General to Administration
- Keywords reporter-feedback added; needs-patch removed
- Priority changed from high to normal
- Severity changed from major to normal
- Keywords reporter-feedback removed
- Resolution set to fixed
- Status changed from new to closed