Home Exclude Posts from WordPress Blog or RSS Feed Based on Tag

    Exclude Posts from WordPress Blog or RSS Feed Based on Tag


    Further to our snippet on removing a category from an RSS feed, this snippet will exclude posts with a specific tag from either showing up in your blog or RSS feed.

    The first snippet will prevent a post from showing up on your WordPress website.

    Copy and paste the WordPress function into your theme's functions.php file or, if you sensibly have one installed, your custom functions plugin.

    If you wanted to exclude multiple tags from showing up, you would do so as follows: $query-> set('tag__not_in',array(3, 4, 5, 6)); and so on. Keep in mind that the numbers relate to the tag ID that you can identify by hovering your mouse over the tag in your WordPress control panel.

    Using a variation of the code above, you can easily exclude posts from showing in your WordPress RSS feed. An RSS feed is often considered to be ‘selective content’, and many bloggers wish to control what information is made available outside of their website. You can accomplish this using the following code.

    You can remove multiple tags from your RSS feed using the method described above.

    Shortt URL for this post: http://shor.tt/1XIc