12% off of LTD using this coupon: TWELVEPERCENTOFF. Promo ends on 2 Dec midnight UTC.
Published on Feb 3, 2021

Other Entries in the Same Taxonomy while Excluding the Current Entry in Oxygen

Sridhar Katakam

This members-only tutorial is similar to Other Posts in the same category while excluding the current post in Oxygen with the difference being that this one is for Custom Post Type and a Custom Taxonomy instead of the standard posts and categories.

We shall use pre_get_posts to filter the posts of a Repeater that has been set to show 5 entries of a project CPT when viewing singular pages of the CPT such that

  1. only the ones in the same custom taxonomy, project_category as the current entry appear AND
  2. the current entry being viewed is not included.

Step 1

Create (if not present) and edit the Template that applies to your CPT's singular view.

Below the Inner Content component that shows your entry's content, add a Repeater having this manual query:


Replace project with your CPT's name.

Configure the Repeater's Div as needed by showing say, the post title linking to permalink.

To show the entry's taxonomy terms, a Text component can be added and its default text replaced with


where project_category is the taxonomy name.

Step 2

Add a Code Block above the Repeater.


This is a premium members-only content.

To view the rest of the content, please sign up for membership ($47/month or $599 one-time).

Already a member? Log in below or here.