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?
Leave a Reply
You must be logged in to post a comment.
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?
You must be logged in to post a comment.
The function,
the_meta()
allows you to hook to thethe_meta_key
filter (which currently is not documented in the Codex); this is where it fires off:http://core.trac.wordpress.org/browser/tags/3.2.1/wp-includes/post-template.php#L735
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:
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 maybedelete_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 :)!