Skip to:
Content

bbPress.org

Opened 7 years ago

Closed 7 years ago

#1896 closed defect (worksforme)

bbPress 2.1 breaks fetch_feed function

Reported by: darkhorse20 Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.1
Component: API - Feeds Keywords:
Cc: stephen@…

Description

Before 2.1 displaying bbPress RSS feeds using the fetch_feed function to output into list items worked just as it should. (code used from here: http://codex.wordpress.org/Function_Reference/fetch_feed)

After 2.1 update, displaying bbPress RSS feeds using fetch_feed function are returning as empty feeds, although they are not empty.

Change History (3)

#1 @johnjamesjacoby
7 years ago

  • Milestone changed from Awaiting Review to 2.1.1

#2 @netweb
7 years ago

  • Cc stephen@… added

#3 @johnjamesjacoby
7 years ago

  • Milestone 2.1.1 deleted
  • Resolution set to worksforme
  • Status changed from new to closed

Closing, as I'm not able to duplicate this. I put the following code in a sidebar, and it works as expected:

$rss = fetch_feed( 'http://bbpress.org/forums/feed' );
if ( !is_wp_error( $rss ) ) :
	$maxitems  = $rss->get_item_quantity(5); 
	$rss_items = $rss->get_items(0, $maxitems); 
endif;
?>
<ul>
	<?php
	if ($maxitems == 0) echo '<li>No items.</li>';
	else
	foreach ( $rss_items as $item ) : ?>
	<li>
		<a href='<?php echo esc_url( $item->get_permalink() ); ?>'
		title='<?php echo 'Posted '.$item->get_date('j F Y | g:i a'); ?>'>
		<?php echo esc_html( $item->get_title() ); ?></a>
	</li>
	<?php endforeach; ?>
</ul>

What I did find, is if you try to use fetch_feed() locally on the same installation, hooked to 'init' or some other early action, you'll infinite loop yourself in circles. I'm open to an elegant core patch to prevent this for 2.2, but for 2.1.1 it's up to the custom code to not run the init (and similar) processes more than once.

Note: See TracTickets for help on using tickets.