Don’t use the ‘helper’ methods, they tend to cause more trouble than they’re worth.
Any time you want to grab posts, be it the latest, the oldest, in a category etc, use a WP_Query
loop, here is its standard form:
$query = new WP_Query( $args );
if ( $query->have_posts() ) {
while ( $query->have_posts() ) {
$query->the_post();
// do stuff
}
wp_reset_postdata();
} else {
// none were found
}
This is what wp_recent_posts
will be doing internally, although it isn’t doing it very well. So save the above to an autocomplete macro in your editor