Skip to content

Commit c06034e

Browse files
malayladusaifsultanc
authored andcommitted
gppa-use-acf-choice-label.php: Fixed PHP fatal error when ACF field set return value as return Both (array).
1 parent 0227f4c commit c06034e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

gp-populate-anything/gppa-use-acf-choice-label.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,10 @@
2222

2323
$label = get_field( str_replace( 'meta_', '', $field->{'gppa-values-templates'}['value'] ), $object->ID );
2424

25+
// When the ACF field's return value as Both (Value and Label), the `$label` is an array. So, we need to get the label from the array.
26+
if ( rgars( $label, '0/label' ) ) {
27+
$label[0] = $label[0]['label'];
28+
}
29+
2530
return $label;
2631
}, 10, 7 );

0 commit comments

Comments
 (0)