Hi there –
I am seeing unexpected behavior on field group location rules.
I have two field groups, A and B.
A is set up to only appear on posts with certain categories. B is set up inversely, to not appear on posts with certain categories. However, on initial load of the ‘add new’ page, field group A shows up (despite no categories being selected). I would like field group B to show up on initial load, when no categories are selected. This behavior also seems to be expected given the field group location rules.
I have tried to account for this through order number, but that didn’t appear to have any impact on the situation.
Here are screenshots of location rules for field groups A and B.
Any idea what’s happening here? Thanks, as always, for your support.
Smart idea – ‘testing’ was in fact the default category. To test this theory, I switched the default category to one not represented in the above screenshots. Under this scenario, I expected field group B (the second screenshot) to appear on a new post. However, field group A still appears.
Would you be willing to access our development site and take a look? I can make an account if you are willing.
And thanks again. Seriously. Can’t believe this is free support. You should offer a tiered service! ACF has become really essential to our development efforts.
Sure, feel free to post your login details.
I still think the issue is with the default category.
When a new post is created, it has NO categories associated with it. ACF is smart enough to realize this empty value, and pretend the value is actually the default one (‘testing’).
Perhaps this is why your location rules are not working. Can you edit the Field group B location rules to only:
post_type = post
category = ‘testing’ (uncategorized)
This should show correctly for new posts with no category selected, but not for posts which contain a specific category
Can you try this first?
The topic ‘Field group location rules – conflict on initial load’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!