• slak

    (@slak)


    Hello,

    i want to hide posts that contains “demo” as tag in any category

    can someone help me?
    thank you

Viewing 1 replies (of 1 total)
  • MichaelH

    (@michaelh)

    Inside your loop try:

    <?php
    $skip = false;
    $skip_tag = 'demo';
    $tags = get_the_tags($post->ID);
    if ($tags) {
      foreach ($tags as $tag) {
        if ($tag->name == $skip_tag) {
          $skip = true;
        }
      }
      if (!$skip) {
        //your post display stuff goes here -- like the_title, the_content, the_excerpt
      }
    }
    ?>

Viewing 1 replies (of 1 total)
  • The topic ‘How to hide post by tag?’ is closed to new replies.