• Hi all,

    I know there’s a few posts to this effect on the forum, but to be honest I’m feeling like a bit of a gumby because I can’t figure out how to make it work.

    I am displaying all posts from one category with the following (please feel free to correct if it’s wrong).

    <?php $section_headlines = new WP_Query('cat=6') ?>
    <?php if ( $section_headlines->have_posts() ) ... etc

    How do I exclude a specific tag from this query? And where do I put it? Does it need to go in my if/while statement?

    Thanks!

Viewing 1 replies (of 1 total)
  • Thread Starter ts

    (@trmash)

    So I may have been having a senior moment – turns out I was editing the wrong file (just been tidying up my theme).

    This seems to be doing the trick, but feedback is still welcomed.

    <?php $section_headlines = new WP_Query(array('tag__not_in'=>'70','cat=6')) ?>

    Thanks.

    ETA: Okay, so now I’m VERY confused. The above code causes the category number to be ignored. So it’s a bit of a fail so far. Back to square one. ??

Viewing 1 replies (of 1 total)
  • The topic ‘Show posts but exclude a specific tag’ is closed to new replies.