I'm making a metabox with a textbox that displays the value of the metakey if I user types and saves data. What I need help with is how the user can delete previous entries as well as edit them if they need to. I've looked all over and can't find anything.

This is what I have to display entries:

<?php if ( get_post_meta($post->ID, 'brk_news_update', true) ) : ?>

$mykey_values = get_post_custom_values('brk_news_update');
foreach ( $mykey_values as $key => $value ) {
echo "$value <br />"; }?>

<?php endif; ?>

All help is greatly appreciated.


Use delete_post_meta to delete a value.


delete_post_meta($post->ID, 'brk_news_update');

If you want to update it, then use update_post_meta

update_post_meta($post->ID, 'brk_news_update','value');
  • What's the best way to make it as a button? – Gregory Schultz Feb 25 '13 at 19:31
  • I'm not sure what kind of button you need. so check this page for example – Giri Feb 26 '13 at 6:35
  • In the metabox, I'm looking for a way to have a link with edit or delete options next to the value. Example: Value from metakey | (edit) | (delete) – Gregory Schultz Feb 26 '13 at 20:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.