Hi there. First of all I explain the estructure and after the problem
I have a custom post type called menu (restaurant menu). That custom post type has got several custom fields and a repeteable group called / named preus (prices). One menu can have different prices (half menu, full menu...). I can add a price clicking in add price (repeteale field)
Example
Shane menu
12€ full menu
8€ half menu
David Menu
16€ full menu
9€ half menu
6€ half menu of cold starters
If I do a custom search of menu that have a price equal or lower than 20, the custom search has no results. To try to find what is happening... I added a new single custom field to menu called preu fantasma (ghost price).
If i do a custom search that search menus with preu fantasma equal or lower than 16 or 9 or any ghost price, the custom search works perfect.
So... the problem is that custom search doesn't work with search of custom post type when I filter that custom post type by a field of repeteable group of that custom post type.
Unfortunately filtering by fields of repeatable field groups is not supported, it was never implemented.
I suggest you submit a feature request so that the product manager is aware of the demand.
What is supported is creating a search where the content is not the menu posts, but where you specify the prices repeatable field group as the content selection, and you can include filters for the fields which belong to that group.
But the query from this View returns the groups of fields, irrespective of the menu post they belong to.
You can output the menu the group belongs to in the results by using the Post Selection tab when inserting a shortcode with the Fields and Views button and specifying that the source post should be the parent of the repeatable field group.
I think it will help for you to understand if you simply try that and see what happens.
I don't understand this:
--------------
What is supported is creating a search where the content is not the menu posts, but where you specify the prices repeatable field group as the content selection, and you can include filters for the fields which belong to that group.
But the query from this View returns the groups of fields, irrespective of the menu post they belong to.
You can output the menu the group belongs to in the results by using the Post Selection tab when inserting a shortcode with the Fields and Views button and specifying that the source post should be the parent of the repeatable field group.
-------------
Can You explain me this again with other words? - > You can output the menu the group belongs to in the results by using the Post Selection tab when inserting a shortcode with the Fields and Views button and specifying that the source post should be the parent of the repeatable field group. Is this like as country - cities?
Make a View where the content selection is your repeatable field group.
Include a search filter for the custom field you want to search by.
In the output section just insert the wpv-post-title shortcode to output the title. You'll note that it outputs the name of the group of fields (because that is what is being queried).
Using the Fields and Views button try inserting the post title again, and use the Post Selection tab to show the options for which post source to use (see screenshot).
The shortcode that is inserted will have an item attribute that specifies the shortcode should use something other than the current post in the loop as the source for the title.
When you do that it should be more clear what is possible.
Ok Nigel. I understand now. You suggest me that I search by repeteable fields and I Show the name of menu related to that price, right?
But my custom search is searching menus by taxonomy of menu, other fields, city where is located the restaurant owner of menu, and price. So...your solution is not right. If i search only by price.. is right but I'm using others filters related to menus.
As I explained in my first reply, what you want to do is not supported, you cannot do it. You can only ask that the feature be added (which I note you have already done).
I was pointing out an alternative (inferior) option, but you cannot mix filtering by other fields and taxonomies belonging to menus with filtering of fields that are part of a repeatable field group, it's simply not possible (even if it is quite reasonable that you would expect to be able to do it).
Only if you remove the repeatable field groups and make the price fields belong directly to the menu posts can you include price in search filters.
Sorry that I don't have a solution for what you actually want to do.
Hi Nigel. It's just that I was saying at the beginning about your suggestion -> To do the same like as related posts. Thanks for your suggestion and thanks a lot for your time, patience and help.
I can't see the details of the View from your screenshots (what post type is being queried, for example).
Can I get access to your site and look at your set up? Then I will be in a position to comment.
I will mark your next reply as private so that I can get log-in credentials from you—you may want to create a temporary admin user for me to use that you can later delete. And be sure to have a current backup of your site.
Which is the View (or Views) I should be looking at?
Your View queries the Menus post type, and so it will return Menu posts.
The post relationship filter you added lets you search for Menu posts that have a repeatable field group from a select list of names, but the query still returns Menu posts.
The "Preu del menu" custom field doesn't belong to the menu post type, it belongs to the repeatable field group, which is not the same thing.
A menu post cannot output a field from a repeatable field group because the field doesn't belong to it. To output the preu del menu custom field you must use a View that queries the repeatable field group.
I know that you really want it to work that you can search menus by the preu del menu field, but you cannot, because of a limitation in how repeatable field groups are implemented.
You have found that you can have a relationship filter but it doesn't actually help.
The only way that you can search/filter menu posts by the preu del menu custom field is if you make preu del menu directly belong to menu posts, and not be part of a repeatable field group.
I hope that one day we will improve this, and when we next review our main development priorities I will push for this to be worked on, but right now I'm out of things to say, other than to apologise once more that it is not possible.