Home Forums ACF PRO Rules based on category & post type not working Reply To: Rules based on category & post type not working

  • Hi John
    In theory no – but because a gallery that should not be on that page according to ACF rules does actually appear the answer is yes. Or rather was yes as I have now changed them to unique values but the problem persists.

    The site is a local history site and covers four areas. Each area has subsections on People, Church, Leisure etc so I set it up as follows:

    4 field groups titled with the area of interest eg Elvington, Waldershare etc
    In each field group there are gallery fields with the names of the subsection ie People, Church, Businesses etc
    The rules for each field group say that the gallery fields should only appear on pages which have the category with the same name as the field group. Because of this I saw no harm in giving fields in different field groups the same names so
    Field group ‘Elvington‘ has a gallery field called ‘People‘.
    Field group ‘Waldeshare‘ also has a gallery field called ‘People
    The Gallery pages have categories corresponding to one of each town name.

    This works fine for three of the galleries – only the Gallery fields in the field group of that category appear in the gallery edit page. But for the fourth gallery is shows the fields for two galleries (towns) – including a sub-heading with that extra field group name – ie the edit page for Elvingtonalso has the gallery fields for Waldershare

    As it happens, on the front end this does not matter – I use an Elementor gallery and the drop down for which images to show dynamically – allows me to just choose the gallery fields for one category (Elvington, Waldershare etc). But it looks messy for the client in the back end and has the potential to confuse.

    The other thing I noticed is that where the extra gallery field shares a name with the gallery fields of the correct town the galleries are populated with the same images – where they are different, there are no images. You can add images to these extra fields but they do not surface on the front end nor do they get added to the galleries on the proper page for that town.

    In retrospect I should have put a qualifier in the name eg elvington_people and waldershare_people. So I edited those field names to correct that but it has made no difference. I even deleted the old field names from the database and the current incorrect field names from the errant gallery page. They just re-appear as soon as you try to edit that page. I attach two screenshots to help explain.

    What annoys me is that there appears to be no logic to this – why do three Galleries behave properly and only one is wrong? I tried deactivating all other plugins but it did not help.