Home › Forums › Backend Issues (wp-admin) › Field group location rules – conflict on initial load
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.
Hi @davisshaver
Thanks for the bug report. I’ll do some testing and get back to you with the results.
Cheers
E
Hi @davisshaver
I have just replicated the 2 field groups and can confirm that they are working correctly.
Perhaps your issue stems from the default post_category. Have you left the default category as ‘Uncategorized’? Or have you renamed it something?
Thanks
E
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.
Hi @davisshaver
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?
Thanks
E
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!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.