Troubleshooting fetch_feed and SimplePie

I’ve got a very basic solution using fetch_feed() and SimplePie to pull in RSS items which is working on my localhost, but for some reason is_wp_error() persists as true on the live server. Is there anyway for me to get specific output about the nature of the error so as to work towards a solution on the live server?

<?php
  include_once(ABSPATH . WPINC . '/feed.php');
  $rss = fetch_feed( '[rss feed removed from example]' );
  if (!is_wp_error( $rss ) ) :
    $maxitems = $rss->get_item_quantity(5);
    $rss_items = $rss->get_items(0, $maxitems);
    $isc="http://dtd.interspire.com/rss/isc-1.0.dtd";
  endif;
?>
<ul class="featured-products">
  <?php if ( $maxitems == 0) : ?>
    <li>No items.</li>
  <?php else : ?>
    <?php foreach ( $rss_items as $item ) : 
      $image = $item->get_item_tags( $isc, 'thumb'); ?>
      <li>...</li>
    <?php endforeach; ?>
  <?php endif; ?>
</ul>

2 Answers
2

add this to your feed

    $rss = fetch_feed( $url );
    if ( is_wp_error( $rss ) ) {
       echo $rss->get_error_message();  <---this
    } else {
   // do your stuff here
}

I would also suggest installing the debug toolbar extensions, like “debug-bar-extender”.

Leave a Comment