WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] feed.php fails in 3.5 (2 posts)

  1. jquindlen
    Member
    Posted 1 year ago #

    Code that previously worked without issue over the last several years has broke in 3.5. Specifically, parsing feeds with SimplePie is no longer working for me in multiple plugins. For instance, this code works in 3.4, but not 3.5:

    <?php
    $maxitems = 0;
    @include_once(ABSPATH . WPINC . '/feed.php');
    @$rss = fetch_feed('http://wpstorecart.com/category/blog/feed/');
    if (!is_wp_error( $rss ) ) : // Checks that the object is created correctly
        // Figure out how many total items there are, but limit it to 2.
        $maxitems = $rss->get_item_quantity(3);
    
        // Build an array of all the items, starting with element 0 (first element).
        $rss_items = $rss->get_items(0, $maxitems);
    endif;
    
    echo '<ul>';
        if (@$maxitems == 0) {
            echo '<li>'.__('No items', 'wpstorecart').'</li>';
        } else {
            // Loop through each feed item and display each item as a hyperlink.
            foreach ( $rss_items as $item ) {
                echo '<li><a style="font-weight:bold;font-size:120%;" target="_blank" href="'. $item->get_permalink() .'" title="Posted">'.$item->get_title().'</a><br />'.$item->get_description().'</li>';
            }
        }
    echo '</ul>';
    ?>

    The code dies inside the foreach() statement. I've looked inside the /feed.php in the repository and see that it has undergone some modifications. Any clue as to what's going and whether this will be fixed?

  2. jquindlen
    Member
    Posted 1 year ago #

    Problem was fixed for me in 3.5-beta1-22172

    I had the problem specifically in 3.5-beta1-22150

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags