8th Oct '25
/
0 comments

Filtering ACF Repeater Bricks Query Loop by Sub Field Value

In the BricksLabs Facebook group a user asked:

I'm displaying an ACF repeater on a page using Bricks query loop. I want to filter the rows based on a radio or select field. Is this possible, or should I use CPT in the query loop instead?

The ACF repeater is for a team members section. Each member has a role. My plan is to create 3 separate loops for each role and display the members in each role separately.

I know this is possible with a CPT but it's a requested modification to an already existing setup. Is it still doable with just querying the ACF repeater or should I just create a CPT and migrate the team members data there?

This Pro tutorial shows how ACF Repeater rows output by a Bricks query loop can be filtered using the bricks/query/run PHP filter.

Consider this field group attached to a Page:

and a sample Page with the Repeater field populated like this:

When this Page or a template that applies to this Page is edited with Bricks, a query loop can be enabled on a Block like this:

to show all the team members on the front end:

Now the objective is to say, show only the team members that are in the Engineering department or only in HR.

After implementing the tutorial - output of two different query loops, each filtered to show only the rows from matching department sub field name:

This works with any ACF field type that contains a string value.

Add the following in child theme's functions.php (w/o the opening PHP tag) or a code snippets plugin:

This is a BricksLabs Pro tutorial.

For full access login below or create your BricksLabs Pro account

Get access to all 612 Bricks code tutorials with BricksLabs Pro

Related Tutorials..

Pro
Meta Box Checkbox List Query Type in Bricks

Meta Box Checkbox List Query Type in Bricks

This Pro tutorial provides the steps to add a new query type in Bricks builder for displaying the values of a Checkbox List type of…
Categories:
Pro
Events grouped by Event Date custom field in Bricks

Events grouped by Event Date custom field in Bricks

This Pro tutorial for Bricks users provides the steps to output posts of an event custom post type dynamically grouped by the value of their…
Categories:
Pro
ACF Term Meta on Single Posts in Bricks

ACF Term Meta on Single Posts in Bricks

Consider this scenario: CPT: Project Custom taxonomy: Project Type Each project will be assigned only one project type. Project Type taxonomy's custom field: Project Type…
Categories:
Pro
Related Posts using ACF Post Object in Bricks

Related Posts using ACF Post Object in Bricks

Modifying the query loop to limit the posts to only related posts via an ACF Post Object custom field.
Categories:
Tags: