When your website means business.

Fix ‘Invalid argument supplied for foreach()’ error

Specifically, this code applies to  gravity-forms-custom-post-types/gfcptaddonbase.php, but it could apply to other instances of the error.

Original code:

foreach( $form_or_field['fields'] as $field ) {
    if( $this->has_tax_enhanced_ui( $field ) ) {
    return true;
    }
}

Fixed (added ‘if not empty’ conditional):

if( !empty($form_or_field['fields']) ) {
    foreach( $form_or_field['fields'] as $field ) {
        if( $this->has_tax_enhanced_ui( $field ) ) {
        return true;
        }
    }
}

Reference Links

Menu
We use cookies in order to give you the best possible experience on our website. By continuing to use this site, you agree to our use of cookies.
Accept
Cookies Notice