Home › Forums › Backend Issues (wp-admin) › Location rules select throws admin-ajax.php 400 error
Hi there,
I’m trying to change a Location rule for a field group, when I click the select input under “Show this field group if” to select anything (e.g. “Page”) the second select turns gray and doesn’t show anything.
If I check the browser Network tab I see the AJAX petition throwing a HTTP 400 error and I can’t understand why. The response from “admin-ajax.php” is “0”.
My temporal workaround is to select “Page”, update/save the field group, then go back and select the page that I want to apply the rule to, but this didn’t happened before in another projects I worked on with ACF so I’m curious about that could be happening here.
Example (in this case using “Post” but happens with any other selected item):
The same thing happens when I’m trying to create a Group type.
It shows the loader, then throws the AJAX error, then the loader disappears and nothing happens. I have to update/save the field group and then the inputs appear after the page was reloaded. It’s really annoying.
Something on the server is interfering with the ajax request. Look at your server php error logs to see if you can find anything there.
I don’t see anything about it in my logs. I will try to fix it this weekend and keep you posted about what’s the issue.
So, I did a quick research and apparently the file “/wp-admin/admin-ajax.php” requires the action to have the string “wp_ajax_” prepend to the action (lines 176-178 and 191-193 in that file). The ACF plugin doesn’t seem to prepend that string (check previous screenshots, where action = “acf/field_group …”), any quick solutions for this?
I am not seeing this error, the issue is not in ACF.
WP automatically adds wp_ajax_ to run the action, this is not something that is supplied on the client side.
Please ensure that you have error logging turned on https://wordpress.org/documentation/article/debugging-in-wordpress/
Deactivate other plugins to see if you can figure out what is interfering. Also check your theme if it is not another plugin. If this fails then try uninstalling and reinstalling ACF, you might have a corrupted file.
You must be logged in to reply to this topic.
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.