I want a way to make all pages with certain tags public.

I don't care if a solution is programatic or via GUI (though I prefer programatic), I just want to be able to make all pages with a certain tag public with just one "click-of-the-button" so to speak.


Oops. I thought pages could have tags just like posts. My intention is to make a bunch of static pages, show them to someone to approve them, and if they approve of the pages, then make them public all at once for the world to see. Is there a way to do this?

  • What do you mean by public? – mor7ifer Feb 20 '12 at 2:37
  • Can you please clarify your question? Pages - i.e. static pages - don't have tags, and by default, all content is publicly accessible. – Chip Bennett Feb 20 '12 at 3:06
  • I am a little confused myself. But I provided an answer based on what I think you're asking and if I am not correct, based on further information I will revise and help you out. – Dwayne Charrington Feb 20 '12 at 3:06

I am not entirely sure what you're asking, so I'm going to stake a wild stab in the dark until you can provide more information provided I don't tell you exactly what you wanted to know. If by public you mean; pages with a certain tag lets say for this example the tag is 'public' and pages that only registered and logged in users can access aren't tagged with public.

The simple answer would be in your post loop you would get a list of post tags assigned to the post using the function wp_get_post_tags and then check to see if the public tag exists, if it doesn't show an error message telling the user the post is not accessible or perhaps even redirect the user using the wp_redirect function.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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