[wp-trac] [WordPress Trac] #12414: delete_post_meta not working correctly when used with save_post
WordPress Trac
wp-trac at lists.automattic.com
Sun Feb 28 09:38:22 UTC 2010
#12414: delete_post_meta not working correctly when used with save_post
-------------------------------+--------------------------------------------
Reporter: studiograsshopper | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 3.0
Component: Administration | Version: 3.0
Severity: normal | Keywords: reporter-feedback
-------------------------------+--------------------------------------------
Comment(by studiograsshopper):
Replying to [comment:1 dd32]:
> This is working fine for me in a test run:
>
> {{{
> var_dump(get_post_meta(1, 'key') );
> array(0) { }
>
> var_dump(add_post_meta(1, 'key', 'value'));
> bool(true)
>
> var_dump(get_post_meta(1, 'key') );
> array(1) { [0]=> string(5) "value" }
>
> var_dump( delete_post_meta(1, 'key') );
> bool(true)
>
> var_dump(get_post_meta(1, 'key') );
> array(0) { }
> }}}
>
> Can you link to the plugin in question which results in the bug? If
theres a bug, Its not due to the functions, rather something along the
line where you're calling it.
>
> Resetting priority/severity until a problem is confirmed.
Here's a test plugin. Install and activate, then add data in the new
metabox, publish post/page. Then blank out one of the fields in the
metabox and click Update.
Upon refresh, you should see that the metabox correctly reflects what
you've just done (one field has content, the other doesn't). Do this with
both a Page and a Post. Check your wp_postmeta table and you'll see that
for the Page, the "empty" postmeta meta_key is still in the db, whereas
for the Post the empty postmeta meta_key has been deleted correctly.
At least this narrows it down to only showing this behaviour with Pages.
So, this seems to be an issue wi
--
Ticket URL: <http://core.trac.wordpress.org/ticket/12414#comment:2>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list