Skip to content

ACF repeater fields type error with array_filter #92

@mikeprince

Description

@mikeprince

The processing of ACF repeater fields produces PHP errors whether ACF is returning post_id or post_object. For the former the error is:

Warning: array_filter() expects parameter 1 to be array, integer given in... \wp-content\plugins\widget-options\includes\widgets\display.php on line 232

and the latter is:

Warning: array_filter() expects parameter 1 to be array, object given in... \wp-content\plugins\widget-options\includes\widgets\display.php on line 232

The fix for either case I believe is to cast to an array by changing line 232 of display.php from:
$acf_implode = implode( ',', array_filter( $acf_array_value) );
to:
$acf_implode = implode( ',', array_filter( (array) $acf_array_value) );

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions