WordPress – hide posts with a certain tag

I have recently taken a look through the portfolio projects on my website. It is a nice walk down memory lane, but also a misrepresentation of what I do nowadays. It is also true about content I have created a long time ago, which is no longer up to date. It would be a pity to delete them, so I have come up with this solution to hide them by tagging.

The tag to use is hidden. You can use your own tags, but be careful to follow the rules for defining a tag in the global posts query.

The code

The simplest way to get this going is to add the following code in your theme’s functions.php file:

The code above can surely be improved – so take your shot at it! 🙂