Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Adds a small footer to all rss & atom feed posts in WordPress.
/********************************************************************************
* Add Footer to WordPress RSS feeds. Add this snippet to your functions.php
*/
function mdr_postrss($content) {
if(is_feed()){
$site_name = get_bloginfo_rss('name');
$post_title = get_the_title_rss();
$home_url = home_url('/');
$post_url = post_permalink();
$content = $content.'<a href="'.$post_url.'">'.$post_title.'</a> is a post from:
<a href="'.$home_url.'">'.$site_name.'</a> which is not allowed to be copied on other sites.';
}
return $content;
}
add_filter('the_excerpt_rss', 'mdr_postrss');
add_filter('the_content', 'mdr_postrss');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment