12% off of LTD using this coupon: TWELVEPERCENTOFF. Promo ends on 2 Dec midnight UTC.
Published on Nov 18, 2020

Bidirectional ACF Relationship Fields in Oxygen

Sridhar Katakam

This members-only tutorial provides the steps to set up an automatic bidirectional relationship between items of two different post types using the ACF Post-2-Post plugin by John A. Huebner II. We shall then use pre_get_posts to set meta query for filtering the items by the related items of the other post type.

In this example we are going to work with event and venue post types.

The related entries can be shown using either Easy Posts or a Repeater.

Event single page:

Venue single page:

Step 1

If you have not already, use a plugin like CPT UI to register your custom post types.

Step 2

Install and activate ACF.

Create a custom field group to appear on the event edit screens like so:

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.

tagschevron-leftchevron-rightchainangle-rightangle-upangle-downfolder-omagnifiercrossmenuchevron-downarrow-right