Add an Attribution Line to Feed Items
Appends "The post ... first appeared on ..." with links to every feed item, which credits you when content is scraped from your feed.
Opens WPIDE on
Code
$wpide_feed_footer = function ( $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', $wpide_feed_footer );
add_filter( 'the_excerpt_rss', $wpide_feed_footer );
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.