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

WP SITES

2670

Original Genesis Tutorials & 5000+ Guaranteed Code

Snippets

  • Tutorial Requests
  • Contact
  • Videos
  • Tags
  • Log in

Premium Member? - Request custom code

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

Brad Dalton Specializes In Genesis child theme customization & code modification. Read More…

Learn PHP Code

template_include

get_body_class

if else

array

class_exists

foreach

sprintf

add_action

printf

variable

Advertise · WPEngine · Genesis · Log in

  • How Premium Membership Works
  • Sign Up
  • Support
  • Subscription Details/Invoice
  • Tagged Tutorials
  • Access-Download Problems