Support » Fixing WordPress » rss.php feeds disappearing – HELP!

  • Resolved ninjaboy

    (@ninjaboy)


    I am using the built-in rss.php WordPress function by using the following code in a site:

    <?php // Get RSS Feed(s)
    include_once(ABSPATH . WPINC . '/rss.php');
    $rss = fetch_rss('http://wordpress.org/development/feed/');
    $maxitems = 5;
    $items = array_slice($rss->items, 0, $maxitems);
    ?>
    
    <ul>
    <?php if (empty($items)) echo '<li>No items</li>';
    else
    foreach ( $items as $item ) : ?>
    <li><a href='<?php echo $item['link']; ?>'
    title='<?php echo $item['title']; ?>'>
    <?php echo $item['title']; ?>
    </a></li>
    <?php endforeach; ?>
    </ul>

    The problem I have is that when I use the above example (WordPress news feed) it is fine, but when I change it to another WordPress feed (from one of my own sites) it appears once, but when I hit refresh the RSS feed disappears!! It’s like it manages to get the feed once, but then doesn’t cache it properly or something!!

    I’m tearing my hair out trying to work this one out – I just don’t understand how this is not working!!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter ninjaboy

    (@ninjaboy)

    I still have not worked out why the feed would display once, and then on page refresh it disappears?!? Anyone have any clues to this?

    Thread Starter ninjaboy

    (@ninjaboy)

    I still have not worked this out – am I doing something obviously wrong here? It’s like it fetches the RSS feed once, and then seems to forget it!!

    I just don’t understand why this isn’t working – is there another way to fetch in RSS feeds easily? Any advice would be much appreciated!

    Thread Starter ninjaboy

    (@ninjaboy)

    Well, I didn’t resolve this using the built-in WordPress RSS feed functionality on it’s own. I still don’t know why this wouldn’t work so I started looking at RSS feed plugins to try and solve this issue.

    After some testing and playing around with code and plugins, I tried the ‘Feed WordPress’ plugin. This didn’t do what I wanted, but I noticed that as part of the installation you had to upload ‘updated’ versions of the core WordPress files rss-functions.php and rss.php.

    As I knew the code above used these core files I thought it was worth a go… and you know what… it worked on my testbed WordPress installation! I then rolled it out just the two updated files form this plugin on anothe testbed site… and it worked!

    So the solution that worked for me was to replace these two core files (not ideal, but it worked!) in conjunction with my original code. I didn’t use the actual ‘Feed WordPress’ plugin, just the ‘updated’ files that are included with this plugin.

    Although you should try and avoid modifying core files, my RSS feeds from other sites simply wouldn’t appear (or they would appear once and disappear on furhter page refreshes). I was tearing my hair out trying to work out what the problem was – hope this helps someone else.

    Same problem here… your workaround fixed it!
    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘rss.php feeds disappearing – HELP!’ is closed to new replies.