From e8bd361a1a795c556e97b6b859b67b086310083c Mon Sep 17 00:00:00 2001 From: Malay Ladu Date: Tue, 18 Feb 2025 17:28:10 +0530 Subject: [PATCH] `gppa-use-acf-choice-label.php`: Fixed PHP fatal error when ACF field set return value as return `Both (array)`. --- gp-populate-anything/gppa-use-acf-choice-label.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gp-populate-anything/gppa-use-acf-choice-label.php b/gp-populate-anything/gppa-use-acf-choice-label.php index 569dafe99..8f16806a9 100644 --- a/gp-populate-anything/gppa-use-acf-choice-label.php +++ b/gp-populate-anything/gppa-use-acf-choice-label.php @@ -22,5 +22,10 @@ $label = get_field( str_replace( 'meta_', '', $field->{'gppa-values-templates'}['value'] ), $object->ID ); + // 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. + if ( rgars( $label, '0/label' ) ) { + $label[0] = $label[0]['label']; + } + return $label; }, 10, 7 );