Skip Navigation

[Resolved] about “Add a query filter to this View”

This thread is resolved. Here is a description of the problem and solution.

Problem:

I created a Repeatable Field Group “Opening time” and tried to add filters in a View, but the expected options don’t appear—only a grey, locked filter shows, and I can’t select additional filters.

Solution:

Set the View’s Content selection to the RFG (“Repeatable Field Groups from the current Gym > Opening Hours”); the owner filter is added and locked by design. Create a separate View to list the RFG items and insert it into the Gym Single Content Template (or use nested Views in legacy mode if building on a separate page).

Relevant Documentation:

https://toolset.com/course-lesson/creating-and-displaying-repeatable-field-groups/

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 3 replies, has 1 voice.

Last updated by Christopher Amirian 3 weeks, 6 days ago.

Assisted by: Christopher Amirian.

Author
Posts
#2820238
query filter-4.jpg
query filter-3.jpg
query filter-2.jpg
gyms custom fields-opening hours.jpg

Dear support team

I'm trying to display a repeating field. I did the following.
1. I created a repeating field "Opening time" in a custom field.
2. I want to select an iterable field group in the [Iterable Field Group] subsection from "query filter" in "Content selection" on the right side of the view block
3.Click "+add a filter" on the right side of the view block
4. Optimal filters are not displayed from "Select"

I would like to solve the above problem, so please support me.

Regards,

Yoshihiko

#2820608

Christopher Amirian
Supporter

Languages: English (English )

Hi,

Welcome to Toolset support. I think I understand the issue, if not, I'd appreciate it if you could give more details.

What’s happening is that the filter you’re looking for only appears when the View is set to query the Repeatable Field Group (RFG) itself, not the parent post type. To iterate your “Opening Hours” entries, the View’s Content Selection must be “Repeatable field groups → Opening Hours”. If the View is set to “Posts → Gyms”, you won’t see the RFG owner/relationship filter in the “Add a query filter” list.

Here’s the correct setup, depending on where you’re displaying the hours.

1) Show Opening Hours on a single Gym page

Add a View block on the single Gym template (or page).

In Choose content, select Repeatable field groups, then pick Opening Hours.

Open Query Filter → Add a filter → choose Post relationship or Repeatable field group owner.

Set it to “Select items that are a repeatable field group owned by the current post in the main query” (wording varies slightly).

Design the loop with the RFG fields (Day of the week, Hours).

This makes the View list only the “Opening Hours” items that belong to the Gym being viewed.

2) Show Opening Hours inside a View that lists Gyms (nested)

Your outer View lists Gyms.

Inside that loop, insert an inner View block.

For the inner View, set Repeatable field groups → Opening Hours.

In the inner View’s Query Filter, add Post relationship or Repeatable field group owner and set it to “owned by the post set by the parent View”.

Output the RFG fields in the inner View’s loop.

This way, each Gym row shows only its own Opening Hours items.

For more information:

https://toolset.com/course-lesson/creating-and-displaying-repeatable-field-groups/

https://toolset.com/2017/08/preview-for-nested-repeating-fields-groups/

Thanks.

#2820669
view-4.jpg
view-3.jpg
view-2.jpg
view-1.jpg

Dear Christopher,

Thank you first for your support.
The settings for displaying repeating fields are as follows.
1. Settings are made to repeat business hours and days in custom fields.
2. In "Repeatable Field Groups from the current Gym" on the right side of the view block, the field's business hours are repeatedly checked.
3. Then, from the query filter, select "Select posts in Any relationship that are related to the Post where this View is shown" I would like to select, but the desired display does not appear in the query filter.

I would like to ask you to verify it again.

Regarads,
Yoshihiko

#2820733

Christopher Amirian
Supporter

Languages: English (English )

Hi Yoshihiko,

When a View's Content selection is set to
"Repeatable Field Groups from the current Gym > Opening Hours",
Toolset automatically adds and locks the correct filter:
"Filter by post relationship or repeatable fields group owner > based on the current content selection."

That’s exactly the grey, non-editable filter you see. This is expected—there is nothing else to add. The "Select posts in any relationship…" choice appears only when a View queries posts and you add a Post relationship filter; it isn’t used for RFGs. RFG items are meant to be filtered by their owner (the Gym).

So basically, you will need one separate view to show the RFG. For more information:

https://toolset.com/course-lesson/creating-and-displaying-repeatable-field-groups/

If you want to have Opening Hours available for each Gym entry, you need to create a view that shows the opening hours and add that view to the Single Content Template of the Gym custom post type.

If the whole thing is added on a separate page, you need to consider using Nested views. One for the RFG and one for the Gyms. That is possible only in the legacy mode.

Thanks.