I would like to suppress the output of one of my custom fields. Is there a way to do this using the <?php the_meta(); ?>command?

  • This works beautifully! THANK YOU so much for your help - I'm certain others will benefit as I've seen similiar requests for help~ I am unable to select this as my answer but will do so as soon as I've figured out what the problem is.
    – mktggirl
    Commented Oct 18, 2011 at 20:46
  • We're glad to have been of help!
    – soulseekah
    Commented Oct 19, 2011 at 3:03

2 Answers 2


The function, the_meta() allows you to hook to the the_meta_key filter (which currently is not documented in the Codex); this is where it fires off:

// wp-includes/post-templates.php @line 744
echo apply_filters('the_meta_key', "<li><span class='post-meta-key'>$key:</span> $value</li>\n", $key, $value);


This filter is applied to each and every meta pair, which means that you can add a filter to suppress based on a specific key, value or key/value pair like so:

function wpse31274_exclude_my_meta( $html, $meta_key, $meta_value ) {
    if( 'remove_this_key' != $meta_key )
        return $html;
    return '';
add_filter( 'the_meta_key', 'wpse31274_exclude_my_meta', NULL, 3 );

Tried and tested, seems to work, so I hope it helps.


Have you tried with delete_post_meta($post_id, $key, $value);?

Since the_meta has not any parameter maybe delete_post_meta is your best option, however I'm totally guessing, I would need to know the context of your project in order to give you a better answer :)!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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