Support » Fixing WordPress » a warning displayed in a widget

  • abhinandh


    here is the warning i get

    Warning: strpos() expects parameter 1 to be string, array given in D:\xampp\xampplite\htdocs\wp-includes\rss.php on line 577

    im trying to add a twitter widget – – with the call
    <?php twitter_messages('abhinandh', 3, true, true, '>>', true, true, false); ?>

    wordpress 2.8.4

Viewing 11 replies - 1 through 11 (of 11 total)
  • esmi


    Forum Moderator

    Looks like there’s problem with that widget and WP 2.8.4



    This happens because the fetch_rss function is deprecated (fetch_feed is the new function) and WP now uses SimplePie instead of the old MagPie. The widget tries to parse a SimplePie Object as a MagPie Object and that breaks things. Took me quite a few hours to figure it out but here’s the fix I came up with:

    Open the wp-content/plugins/twitter-for-wordpress/twitter.php file.

    Find and delete – 2 instances

    include_once(ABSPATH . WPINC . ‘/rss.php’);

    Find and replace – 2 instances

    $messages = fetch_rss(‘’.$username.’.rss’);


    $messages = fetch_feed(‘’.$username.’.rss’);

    Find and replace

    if ( empty($messages->items) ) {


    $feed_count = $messages->get_item_quantity();
    if ( empty($feed_count) ) {

    Find and replace

    foreach ( $messages->items as $message ) {
    $msg = ” “.substr(strstr($message[‘description’],’: ‘), 2, strlen($message[‘description’])).” “;
    if($encode_utf8) $msg = utf8_encode($msg);
    $link = $message[‘link’];


    foreach ( $messages->get_items() as $message ) {
    $desc = $message->get_description();
    $date = $message->get_date();
    $msg = ” “.substr(strstr($desc,’: ‘), 2, strlen($desc)).” “;
    if($encode_utf8) $msg = utf8_encode($msg);
    $link = $message->get_link();

    Find and replace

    $time = strtotime($message[‘pubdate’]);


    $time = strtotime($date);

    That should be it. Widget now works perfectly with WP 2.8.4, enjoy 😉

    Thank’s you’re a life saver!

    Though in my ‘twitter for wordpress’ the second instance of :

    $messages = fetch_rss(''.$username.'.rss');

    is actually:

    $messages = fetch_rss(''.$item['username'].'.rss');

    if I changed this to:

    $messages = fetch_feed(''.$item['username'].'.rss');

    its seems to work great for me.

    i have the same problem as abhinandh, and thanks to FreekOne, help so much.

    Same problem here, thx for the solution

    Thanks. It’s a shame the owner doesn’t update his plugin.

    Spectacular fix!

    Thank you so much, absolutely perfect.

    after the fix from FreekOne i don’t get errors anymore but the tweets aren’t updating anymore 🙁

    Fixed perfectly..!

    Thanks for that solution, it works perfectly..

    Lovely, great work thank you, just implemented the code and no issues seamless update, maybe you could take over this plug in 😉

    Thank you!

    Integrati marketing team.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘a warning displayed in a widget’ is closed to new replies.