diff --git a/includes/class-syndication-wp-xml-client.php b/includes/class-syndication-wp-xml-client.php index 24a2930d49f0ca09c79b0d3d352f8058d6f2d07f..a8d5ac15ca6e41b2b23febf52697380dd974f493 100644 --- a/includes/class-syndication-wp-xml-client.php +++ b/includes/class-syndication-wp-xml-client.php @@ -181,7 +181,14 @@ class Syndication_WP_XML_Client implements Syndication_Client { } $post_position = 0; - foreach ($xml->xpath($post_root) as $item) { + $items = $xml->xpath( $post_root ); + + if ( empty( $items ) ) { + self::log_post( 'n/a', null, get_post($this->site_ID), sprintf( __( 'No post nodes found using XPath "%s" in feed', 'push-syndication' ), $post_root ) ); + return array(); + } + + foreach ( $items as $item ) { $item_fields = array(); $enclosures = array(); $meta_data = array();