Skip to main content

Timeline for remove a single post_meta

Current License: CC BY-SA 3.0

10 events
when toggle format what by license comment
Jul 2, 2013 at 23:02 vote accept Franz Noel
Jul 2, 2013 at 23:01 comment added Franz Noel It may seem to be harder to add postmeta if one meta box deals with add_post_meta and another meta box deals with update_post_meta because it does not support good practice. In having multiple posts in one meta and single post meta in another, using json to store data in one field would be easier. Manipulating the json data is also easier rather than dealing with add_post_meta and update_post_meta if this is the case.
Jun 28, 2013 at 21:21 comment added s_ha_dum Backup, forget this part "This is just a concept to discuss. So, no code really needed." and edit you question with your code. Code is necessary.
Jun 28, 2013 at 21:20 comment added Franz Noel I tried this and it does not work because there are 2 hooks for publish_post and save_post. Maybe this will work in a json setting where you update one field.
Jun 28, 2013 at 18:07 comment added s_ha_dum You also give delete_post_meta a key but take a careful look at the answer. delete_post_meta will delete the entire key. That is why I said delete_post_meta will not work. You need to pull the data, process it in PHP and then put the data back.
Jun 28, 2013 at 18:07 history edited s_ha_dum CC BY-SA 3.0
added 436 characters in body
Jun 28, 2013 at 17:58 comment added Franz Noel If you're going to send the whole $post->ID and it will get the array of records, how can I detect the specific meta_key set to be deleted?
Jun 28, 2013 at 17:44 comment added s_ha_dum Your description makes me think delete_post_meta won't work, but the short answer to that question is that you have to give the post ID to the function.
Jun 28, 2013 at 17:43 comment added Franz Noel Where would the delete_post_meta() get the $post_id from? I'll place the code anyway... just a sec.
Jun 28, 2013 at 17:21 history answered s_ha_dum CC BY-SA 3.0