I’m trying to use the location rules to set groups of custom fields for specific post categories, and it simply doesn’t work (or I’m missing something …).
The only location rule that works is “POST equal a specif post” …
Any aidea about how to solve this ?
Thank you in advance.
Could you please share a screenshot of your location rule? If you want to set the field group to posts in certain categories, I believe you need to set it to “Post Category” “is equal to” “Category Name”. If you want to set it to certain categories, you need to have this rule: “Taxonomy Term” “is equal to” “category”. I’ve attached a screenshot for your reference.
If still no luck, could you please check the developer tool on your browser for any error messages?
Thank you for your reply.
I just tried exactly your configuration, and still have the same problem … Here are two screenshots, one of the ACF configuration, and the other of the post editing screen. The custom fields just disappear from the post’s backend screen.
The only way to have them come back, is to change the rule to POST = The Post title.
I checked the errors, from the browser, I only get warnings. Do you want me to copy them here ? (it’s a long list).
Also, I tried to desactivate WPML plugin, but the problem stays there.
Thank you again,
Looking at your screenshots, I believe you only need this location rule: “Post Category” “is equal to” “Category Name”. Don’t forget that you need to select the category on the editor page to show the field group. If you have already done that, could you please share the JSON or XML export of your field group so I can test it out on my installation?
Yes indeed, I actually put the second rule only to make the exact test as described in the previous message. Initially I only configured the right rule, with the post category.
Of course I assigned the category to the post, in order to show the fields in the editor page of the post.
Here is the XML export of the group.
Thanks for the export file.
Do you have a cache plugin activated in your site? If you have, could you please clear the cache?
Also, could you please tell me what version of ACF did you use? ACF free has version 4.4.5 now. If you have the older version, could you please update it?
I’ve checked your export file, and it seems that the field group is set to posts with IDs of “69” and “699,” not the post category. It’s possible that you have a cached version of the field group or have the field groups generated using PHP code.
Could you please try to reproduce the issue on one of the WordPress’ stock themes (like Twenty Fifteen) with other plugins deactivated? If it disappears, then you can activate the theme and plugins one by one to see which one causes the issue.
I have no cache plugin activated, I’m still developing the website.
Yes, this location rules are the only ones that let me show the fields, and keep working until we resolve this issue 🙂
Well, I changed the theme to the one you mentioned, and it is working.
The theme I’m using is DIVI, not modified, as I’m working on a child of this theme.
I tested with both theme and child, same problem.
Any idea ?
I’ll write to Divi support today.
Just to let you know, I realize this : when first loading the post page, the fields actually appear, and disappear, when the page is fully loaded.
Here is a screenshot of the fields, before the Divi builder loads, and the whole page is fully loaded …
But why this happens with location rules, I don’t have clue …
Have you tried to reproduce the issue on one of the WordPress’ stock themes (like Twenty Fifteen) with only ACF activated? The issue @jjorio had mostly because of a theme conflict. It seems there was a JS script that prevents the fields from showing up.
If using WordPress’ stock theme fixes the issue, then could you please get in touch with Divi support regarding this issue?
The topic ‘Back end location rules not working’ 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!