Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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) ) : ?>

<?php
$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.

share|improve this question
add comment

1 Answer

Use delete_post_meta to delete a value.

Example:

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');
share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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