add_filter accepts second parameter as callback function name not just string.
return
cannot be call inside loops like you did. It will just stop executing script.
return
only be declared inside functions/methods
Your loop will be like this:
foreach($recent_posts as $post)
{
echo $post->post_content . '<br />Some text appended to Post';
}
Actually you don't have to apply any filter here. Just append the $post
property post_content
with your value.