Skip to content

Commit ff03e78

Browse files
authored
Fix campaigns dropdown output (#22)
2 parents b71c279 + 3922e2c commit ff03e78

File tree

1 file changed

+3
-19
lines changed

1 file changed

+3
-19
lines changed

includes/helpers.php

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -100,20 +100,14 @@ function amnesty_get_wooccm_field( $field_name = '' ) {
100100
return [];
101101
}
102102

103-
if ( ! is_admin() ) {
104-
$field_name = sprintf( 'additional_%s', $field_name );
105-
}
106-
107103
$cache_key = sprintf( '%s-%s', __FUNCTION__, $field_name );
108104
$cached = wp_cache_get( $cache_key );
109105

110106
if ( $cached ) {
111107
return $cached;
112108
}
113109

114-
if ( is_admin() ) {
115-
$fields = array_column( $fields, null, 'name' );
116-
}
110+
$fields = array_column( $fields, null, 'name' );
117111

118112
if ( ! isset( $fields[ $field_name ] ) ) {
119113
return [];
@@ -185,19 +179,9 @@ function amnesty_get_campaign_field_options( $field_name = '', $filter_callback
185179
return [];
186180
}
187181

188-
if ( is_admin() ) {
189-
return array_filter(
190-
array_map(
191-
function ( $op ) {
192-
return $op['label'];
193-
},
194-
$field['options']
195-
),
196-
$filter_callback
197-
);
198-
}
182+
$options = array_map( fn ( array $option ): string => $option['label'], $field['options'] );
199183

200-
return array_filter( $field['options'], $filter_callback );
184+
return array_filter( $options, $filter_callback );
201185
}
202186
}
203187

0 commit comments

Comments
 (0)