widget-options icon indicating copy to clipboard operation
widget-options copied to clipboard

ACF repeater fields type error with array_filter

Open mikeprince opened this issue 5 years ago • 0 comments

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) );

mikeprince avatar May 02 '20 13:05 mikeprince