Link back to your site in the RSS feed
Adds “The post … first appeared on …” with links to the end of every post in your feed. Scraper sites that copy your feed then link back to you.
<?php
$snipfire_feed_footer = static function ( $content ) {
if ( ! is_feed() ) {
return $content;
}
return $content . sprintf(
'<p>The post <a href="%1$s">%2$s</a> first appeared on <a href="%3$s">%4$s</a>.</p>',
esc_url( get_permalink() ),
esc_html( get_the_title() ),
esc_url( home_url( '/' ) ),
esc_html( get_bloginfo( 'name' ) )
);
};
add_filter( 'the_content_feed', $snipfire_feed_footer );
add_filter( 'the_excerpt_rss', $snipfire_feed_footer );
In these packs
- RSS feeds: Control what your RSS feed shows, and when.