Working with relational fields inside query loops

Learn how to use relational fields in Bricks loop

The relational fields can be used in the Brick builder query loops.

Let's see an example.

First of all, suppose you have a CPT called movie and another one called post.

Setup a one-one bidirectional relation between.

You'll have something like this:

Now, move to Bricks editor.

To fetch all the posts from the above relational field value, you need to set a query loop adding a custom meta query:

  • meta keys: the name of the movie meta field

  • value: {post_id}

  • operator: LIKE

In this case, only one post will be fetched, since the relational is one-one.

Last updated