I’m putting my hair out trying to debug this issue. It could be an incompatibility between the latest ACF and WP, or it could be my own dev issue. The only change I can tell is updating plugins/core. I’ve searched and have found a few other users with the same problem, but they were for previous versions and the resolution seemed to be “revert to previous version or wait for bug fix.” I’m not aware of any current issues, but I’m having the problem regardless.
– I have a custom post type that has a few custom taxonomies as fields. (e.g., “Workshop Session” is the post type, and “Location” is a related taxonomy.
– When I’m editing a post, everything is fine until I choose an item from a taxonomy dropdown. (1) I click on the dropdown, (2) it loads the data, and (3) I choose the one I want.
– When I click on the taxonomy term that I want, an AJAX POST call is made with the “acf/ajax/check_screen” action. The server returns a valid response (200).
– Then, the entire admin panel (“.acf-postbox”) containing the custom fields gets hidden as do all of my custom fields. Saving doesn’t preserve the modified data.
– Advanced Custom Fields v 5.7.6
– WP v4.9.8
– Running under Apache2 with PHP7.2 FPM.
– Server is behind CloudFlare, but same error if I disable it.
No errors show up in the logs (Apache, PHPFPM, nor in wp-content/wp-debug.log when I activate it). I’m seeing no errors in the browser console either. When I debug the AJAX call in the browser, I see this (no errors that I can tell):
More info: I’ve done some regression testing, and find that the error disappears if I revert to v5.7.3. 5.7.4, 5.7.5 and 5.7.6 all exhibit the same error. I noticed in the change log that 5.7.4 introduced some improvements in AJAX handling, which may be causing the incompatibility.
For me, the fix (for now, anyway) is to replace the plugin with the last known “good” version:
The issue sounds like ACF is incorrectly “re-adding” the field group metabox after a “post attribute change” is detected.
This is possible if the field group is missing a “key” setting.
If you are using PHP to register the field group, can you please check your PHP field group and ensure that the field group itself has a unique key?
I faced the same issue while adding the field group via PHP using the
current_user action hook and generating the field value dynamically, based on the post_id.
By its nature the AJAX call does not recognize the
current_user action hook (and others). Switching to
admin_init did the trick for me. The field group will then remain visible when assigning a taxonomy term.
The topic ‘Taxonomy Selection in Dropdown Causes Form to Disappear’ 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!