From f5bcdfe5fcfbb5718697c898cbcfa711df068156 Mon Sep 17 00:00:00 2001 From: Derrick Koo Date: Wed, 16 Dec 2020 10:37:49 -0700 Subject: [PATCH] fix: avoid a PHP warning when updating a non-single meta value --- includes/newspack-listings-utils.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/newspack-listings-utils.php b/includes/newspack-listings-utils.php index 8675c0a2..420bf297 100644 --- a/includes/newspack-listings-utils.php +++ b/includes/newspack-listings-utils.php @@ -107,7 +107,7 @@ function get_data_from_blocks( $blocks, $source ) { } // If the source has 'single' specified, only get data from the first found block instance. - if ( $source['single'] ) { + if ( isset( $source['single'] ) && ! empty( $source['single'] ) ) { $matching_blocks = array_slice( $matching_blocks, 0, 1 ); } @@ -138,7 +138,7 @@ function get_data_from_blocks( $blocks, $source ) { } // If the source has 'single' specified, only return data from the first found block instance. - if ( $source['single'] ) { + if ( isset( $source['single'] ) && ! empty( $source['single'] ) ) { return array_shift( $data ); }