get_item_quantity() Error When Fetching Feed

This happens, because Twitter stopped the API v1. To get around WP_Error in your code:

// functions.php
function fetch_twitter()
{
    $rss = fetch_feed('https://api.twitter.com/1/statuses/user_timeline.rss?screen_name=BarackObama');

    if ( is_wp_error( $rss ) )
        return;

    // continue in your function
    $maxitems = $rss->get_item_quantity(3);
}

// template
fetch_twitter();

Won’t help much in your case. Switch to the new API.


tech