diff --git a/includes/class-syndication-wp-xml-client.php b/includes/class-syndication-wp-xml-client.php index 7e5cdaf6bfc9ad9a3b03ee132cd0a8b87e64e3b3..fdea225c83203866c7e4034f13052e5e5812ba82 100644 --- a/includes/class-syndication-wp-xml-client.php +++ b/includes/class-syndication-wp-xml-client.php @@ -211,7 +211,15 @@ class Syndication_WP_XML_Client implements Syndication_Client { $value_array = $item->xpath( stripslashes( $save_location['xpath'] ) ); } if (isset($save_location['is_meta']) && $save_location['is_meta']) { - $meta_data[$save_location['field']] = (string)$value_array[0]; + //SimpleXMLElement::xpath returns either an array or false if an element isn't returned + //checking $value_array first avoids the warning we get if the field isn't found + if( $value_array && ( count( $value_array ) > 1 ) ) { + $value_array = array_map( 'strval', $value_array ); + $meta_data[$save_location['field']] = $value_array; + } else if ( $value_array ) { + //return a string if $value_array contains only a single element + $meta_data[$save_location['field']] = (string) $value_array[0]; + } } else if ( isset($save_location['is_tax']) && $save_location['is_tax'] ) { //for some taxonomies, multiple values may be supplied in the field foreach ( $value_array as $value ) {