Add parameter for Exclude a particular custom field key from the_meta output

  1. Inactive


    Template tag, the_meta , has no parameters currently.

    Please add a parameter so that the_meta can EXCLUDE a particular Key-Value.

    It could be something like, php the_meta(exclue="Small-image")


    the_meta will display all the custom fields on a post. It will display them as Key - Value pairs. For example I could make my post display:
    My Mood: Happy
    The Weather Is: Sunshine
    The song of the day is: "You Are My Sunshine"
    Small-image: http://mysite.com/wordpress/wp-content/november-sun.jpg

    In my example I want the_meta to show all the custom fields EXCEPT for "small-image".

    The other custom fields are intended for public display, but I use one of my custom fields for some code-like info that I don't want to display in writing on the blog where I put the_meta.

    Adding this parameter would be backwards compatible with older WP. The old way of putting the_meta() would still work fine.

    Posted: 10 years ago #

  2. Inactive


    MichaelH posted some code in the Support Forum. Code to put in The Loop that will Exclude certain named custom-fields from the output of the_meta() function.

    The code is described here,

    I still believe this should be integrated as a Parameter on the_meta in the WordPress core.

    Posted: 10 years ago #
  3. krembo99


    Great Idea, I had the same problem on some websites, and had to use the individual meta names.
    This system is much much better.
    Implementation is a must IMHO being all teh custom plugins that use the_meta as for today.

    Posted: 9 years ago #
  4. Stephanie Leary

    I believe key names beginning with underscores are automatically ignored, so you could use _small-image in your example.

    Of course, there's now the post-thumbnail field as well.

    Posted: 8 years ago #
  5. Mark


    You can easily display custom fields selectively using PHP variables.

    Posted: 8 years ago #
  6. Mark / t31os


    Stephanie's suggestion is a great one, meta keys starting with underscores should be ignored.

    Posted: 8 years ago #

RSS feed for this topic


You must log in to post.

  • Rating

    6 Votes
  • Status

    This idea is under consideration