From 4acfcc62e0eb95b9e114d115a88fd9f8bcc93356 Mon Sep 17 00:00:00 2001 From: Nabil Kadimi Date: Tue, 11 Sep 2018 23:56:47 +0100 Subject: [PATCH] Refactor --- includes/class-sp-event.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/includes/class-sp-event.php b/includes/class-sp-event.php index d580044e..76f471af 100644 --- a/includes/class-sp-event.php +++ b/includes/class-sp-event.php @@ -579,16 +579,14 @@ class SP_Event extends SP_Custom_Post{ $appointments = array(); foreach ( $duties as $duty ) { - $duty_appointments = sp_array_value( $officials, $duty->term_id, null ); + $duty_appointments = sp_array_value( $officials, $duty->term_id, [] ); if ( ! $include_empty && empty( $duty_appointments ) ) continue; $appointed_officials = array(); - if ( is_array( $duty_appointments ) ) { - foreach ( $duty_appointments as $duty_appointment ) { - $appointed_officials[ $duty_appointment ] = get_the_title( $duty_appointment ); - } + foreach ( $duty_appointments as $duty_appointment ) { + $appointed_officials[ $duty_appointment ] = get_the_title( $duty_appointment ); } if ( $include_empty && empty( $appointed_officials ) ) $appointed_officials[] = $placeholder;