Home › Forums › Backend Issues (wp-admin) › Conditional Logic not working?
When trying to create conditioanl logic for a field it doesnt work.
After clicking “Yes” on the Conditional Logic it just says “or <Add rule group>”. Click “Add rule group” does nothing. If i have conditional logic checked, I get the following error message:
Warning: Invalid argument supplied for foreach() in /the/path/is/strong/wp-content/plugins/advanced-custom-fields-pro/api/api-field.php on line 732
Warning: Cannot modify header information - headers already sent by (output started at /the/path/is/strong/wp-content/plugins/advanced-custom-fields-pro/api/api-field.php:732) in /the/path/is/strong/wp-includes/pluggable.php on line 1121
Was about to also post about exact same issue as I make heavy use of it. Trying to finalise back end UI which currently has exploded into a total mess 🙁
Same issue, behaviour as reported by smartmediaas above. ACF Pro 5.0.1, no other plugins installed. Fresh WP 3.9.1 install on MAMP.
I hacked api-field.php with the following snippet to stop the stack trace and allow me to access the back end again until the update with the fix is released.
It just checks to see if $groups in an array, in this case the value for conditional_logic was an int. The error happened because the code was trying to do a foreach() on the non array.
if ( is_array ( $groups) ) {
// remove empty rules
foreach( $groups as $group ) {
if( !empty($group) ) {
$field['conditional_logic'][] = $group;
}
}
} else {
$field['conditional_logic'][] = $group;
}
I am sure this is not a fix, rather just a band-aid to stop the bleeding. It does give me access to wp-admin again 🙂
The topic ‘Conditional Logic 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!
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.