• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2785

Original Genesis & WooCommerce Tutorials & 6000+ Guaranteed Code

Snippets

  • Try Premium
  • Log in

3 Ways To Exclude Posts With Specific Tag I.D’s From Displaying In Your Loop

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.

Reader Interactions

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

Code written by Brad Dalton specialist for Genesis, WooCommerce & WordPress theme customization. Read More…

Advertise · WPEngine · Genesis · Log in

  • Access Problems
  • Account Details
  • Consulting
  • Tags