Forums › Forums › Search & Filter Pro › Same Custom Field Used Multiple Times
Tagged: custom fields
- This topic has 4 replies, 2 voices, and was last updated 8 years, 1 month ago by Anonymous.
-
Anonymous(Private) November 7, 2016 at 11:03 am #68955
I want to make posts searchable by Prefectures and Districts in Japan. I can make one Field Group in ACF with two fields (prefectures and districts) and apply it to ALL posts and the search function would work. However, there are 47 prefectures and over 1700 districts in Japan which would mean (in theory) that I would have an incredibly long drop-down menu in the posts for the districts–something that is difficult to work with.
To avoid this I created a field group for each prefecture in ACF which would have the same field name (districts) but the values would be different for each prefecture. So, for example, when I look at posts within the category “Tokyo” I would see A, B, C and when I look at posts with the category “Kanagawa” I would see D, E, F as options.
This is fine, but when I created a search form based on the field name the options for checkbox only showed D, E, F (perhaps because that was the last field group I created).
It seems the field values are not being merged. Is this a limitation with ACF or is there a work around for this with the Search & Filter plugin.
Thank you in advance once again! I hope my question is clear.
Trevor(Private) November 7, 2016 at 11:57 am #68976I think it is an issue with ACF. It should not let you have a field ‘slug’ name that is already in use, as slug names are supposed to be unique in WordPress, within the use context that it is in (e.g. custom fields). They will almost certainly have an ID attached as well, which WILL be different. What S&F does is to find the first instance of a custom field type with that slugname and take those values.
I have checked the ACF documentation to see if it is possible to cause one choice field to have its values filtered by an option chosen on another, and it is not (at least not without javascript on the editor page).
-
AuthorPosts