How to Hide Specific Custom Post Fields

Some WordPress plugins use custom post fields [http://codex.wordpress.org/Using_Custom_Fields] to store data associated with specific posts. This is a good way, but if you want to display your own Custom Post Fields under your post, this method can cause problems with the display of unnecessary data.

Fortunately, users of version 1.5 and above of our GavernWP framework have had a solution to this problem! In the following example, I’ve added an additional custom post field named “some_test” – this custom post field is displayed under other custom post fields:

Gavern WordPress Framework quick tip 4 1

So, how can I remove only this field? With the GavernWP Framework this is easy to achieve – I go to the Advanced theme settings and locate the option named, “Hidden Custom Post Fields”:

Gavern WordPress Framework quick tip 4 2

In this field, simply enter the names of those fields to be hidden, separated by commas. (You may also completely disable the display of custom post fields by setting the “Custom fields” to ‘Disabled’.) In our example, we enter the text “some_test” into the Hidden Custom Post Fields field:

Gavern WordPress Framework quick tip 4 3

Now, back at the front-end, the unnecessary custom post field should no longer appear:

Gavern WordPress Framework quick tip 4 4

So, the next time you find strange values at the end of your posts, remember to use this handy feature. If you don’t use the Custom Post Fields feature on your website, then you are better off disabling the “Custom Fields” option entirely.

Feel free to apply this tip using our free theme – Meet GavernWP

How to Hide Specific Custom Post Fields 5.005 (100.00%) 3 votes
Share
This article was first published February 4th, 2013