From b1f53450c06e56ad39b6a6daffa51276ffd1641b Mon Sep 17 00:00:00 2001 From: padams Date: Mon, 9 Nov 2020 22:49:38 -0800 Subject: [PATCH] check for keywords before looping. --- modules/metadata/XmpReader.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/modules/metadata/XmpReader.php b/modules/metadata/XmpReader.php index 075aced..092c4b4 100644 --- a/modules/metadata/XmpReader.php +++ b/modules/metadata/XmpReader.php @@ -64,15 +64,19 @@ public function registerShortcuts( $value = '', $tag, $xmp ) { $child_taxonomy_delimiter = pp_api::getOption('core', 'metadata', 'custom_taxonomies_tag_delimiter') ?: ':'; // drop keywords uses as child taxonomies. - foreach ( $keywords as $k => $v ) { + + if ( $keywords ) { - if ( ! strpos($v, $child_taxonomy_delimiter ) ) { + foreach ( $keywords as $k => $v ) { - $nkeywords[] = $v; + if ( ! strpos($v, $child_taxonomy_delimiter ) ) { + + $nkeywords[] = $v; + } } + + return implode( ', ', $nkeywords); } - - return implode( ', ', $nkeywords); } }