Skip to content

Commit

Permalink
fix: avoid a PHP warning when updating a non-single meta value
Browse files Browse the repository at this point in the history
  • Loading branch information
dkoo committed Dec 16, 2020
1 parent 6b5dc36 commit f5bcdfe
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions includes/newspack-listings-utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}

Expand Down Expand Up @@ -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 );
}

Expand Down

0 comments on commit f5bcdfe

Please sign in to comment.