From 3922e2c9d2825c9c0b19891c28ad95101bfd9070 Mon Sep 17 00:00:00 2001 From: Jay McPartland Date: Tue, 4 Mar 2025 13:21:33 +0000 Subject: [PATCH] Fix campaigns dropdown output --- includes/helpers.php | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/includes/helpers.php b/includes/helpers.php index b4a82a7..a33f8a0 100644 --- a/includes/helpers.php +++ b/includes/helpers.php @@ -100,10 +100,6 @@ function amnesty_get_wooccm_field( $field_name = '' ) { return []; } - if ( ! is_admin() ) { - $field_name = sprintf( 'additional_%s', $field_name ); - } - $cache_key = sprintf( '%s-%s', __FUNCTION__, $field_name ); $cached = wp_cache_get( $cache_key ); @@ -111,9 +107,7 @@ function amnesty_get_wooccm_field( $field_name = '' ) { return $cached; } - if ( is_admin() ) { - $fields = array_column( $fields, null, 'name' ); - } + $fields = array_column( $fields, null, 'name' ); if ( ! isset( $fields[ $field_name ] ) ) { return []; @@ -185,19 +179,9 @@ function amnesty_get_campaign_field_options( $field_name = '', $filter_callback return []; } - if ( is_admin() ) { - return array_filter( - array_map( - function ( $op ) { - return $op['label']; - }, - $field['options'] - ), - $filter_callback - ); - } + $options = array_map( fn ( array $option ): string => $option['label'], $field['options'] ); - return array_filter( $field['options'], $filter_callback ); + return array_filter( $options, $filter_callback ); } }