WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Can you please let me know if it is possible to control Visibility of some html elements like and which are loading from an specific taxonomy terms meta data? I For Example I have two metadata as "Make" and "Year" for my custom post and I would like to ONLY hide the meta (Make and Year) for my post with specific Custom Taxonomy term = "Hback" (Not for any other terms)


share|improve this question

This question is not very detailed but I think you are talking about hiding parts of the markup for a post. If that is the case then has_term should be what you want.

if (!has_term('Hback','tax-slug')) {
  // markup that does not show for 'Hback'

'tax-slug' is the taxonomy-- a WordPress core taxonony like 'post_tag' a custom taxonomy that you or a plugin has created. You need to provide a third parameter containing the post ID or the post object if you are not meaning to check for the current post in a loop.

share|improve this answer
Hi s_ha_dum,sorry for confusion and thanks for your comment. OK let me explain a little bit. what I want to do is rendering CPT's title, and two meta box values (Make, Year). I am displaying all the post based on their taxonomy terms perfectly but in some taxonomy terms like "hback" I didnt have any information to fill the meta data. and right now thy are displaying empty in the page (Only meta data section). like Make = <> Year =<>. so I thought I may can handle this from administrator panel. Adding a meta data (check-box) to Custom Taxonomy to hide or display the ONLY custom post meta data? – Behseini May 24 '13 at 16:58
Can someone help me about this one please? – Behseini May 27 '13 at 16:23
Edit your question with the additional details, please. – s_ha_dum May 27 '13 at 17:49
... but I am pretty sure I just told you how to selectively show or hide meta data based on the taxonomy terms, which even after your clarification still sounds like what you want. You don't need a checkbox. Just show the data if it is present. – s_ha_dum May 27 '13 at 17:52
Oh,so you mean it will automate the process? I got your point now! and thank you. but I need also make them to be visible/hide explicitly! is it possible to do this by administrator select option like checkbox? Once again thanks for your time and support. – Behseini May 27 '13 at 18:28

Your Answer


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.