Tell me more ×
WordPress Answers is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

How to prevent post entries, unless otherwise indicated tags for the post?

share|improve this question
What exactly are you trying to do? do you want to prevent post from beeing published if no tags is set? – ferenyl Nov 9 '12 at 14:27

closed as not a real question by toscho Feb 18 at 23:42

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, see the FAQ.

1 Answer

You can keep them from showing by using something like this:

<?php
/* 
 Template Name: Tags
*/
?>
<?php get_header(); ?>
<div id="posts">
  <?php
  if( has_tag() ) {
  if (have_posts()) : ?>  
      <?php while (have_posts()) : the_post(); ?>  
          <?php the_content('Read the rest of this entry'); ?>  
      <?php endwhile; ?>  
      <?php else : ?>   
  <?php endif; } else { ?>
    <h2 id="no-tags">
      <a href="<?php echo get_option('home'); ?>">Back Home</a>
    </h2>
  <?php } ?>
</div>
<?php get_footer(); ?>

That is a very simple template just for this example. It would return a link to the home page if no tags were set. You could customize it to do something else.

share|improve this answer

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