There’s different ways to use PHP code in your child themes functions.php file to remove all posts which include a specific tag or tags.
1. The pre_get_posts function is one of the best to use for this purpose.
The above code will prevent posts with the tag i.d’s included in the array from displaying on your home page loop which can be your front page or a specific blog page according to your Reading Settings.
2. You could also use the request filter.
3. Another way to do this is to create a new WP_Query which handles multiple tags in an array.
Leave a Reply
You must be logged in to post a comment.