I'm trying to remove the "The post xxx appeared first on xxx" line in my RSS feed using the the_content_feed hook. I've tested the regex function outside wordpress on the feed and it works.
I'm using the my custom functions plugin to insert this into functions.php.
It does not seem to be working and I'm at a loss. Any ideas?
add_action('the_content_feed', 'remove_rss_links');
function remove_rss_links($content) {
return preg_replace(".*appeared first on.*$", "", $content);
}
Here is part of my feed (slightly redacted):
</p>
<p>The post <a rel="nofollow" href="/">Tees</a> appeared first on <a rel="nofollow" href="">Golf Course Renovation</a>.</p>
]]></description>
I'm trying to remove the "The post xxx appeared first on xxx" line in my RSS feed using the the_content_feed hook. I've tested the regex function outside wordpress on the feed and it works.
I'm using the my custom functions plugin to insert this into functions.php.
It does not seem to be working and I'm at a loss. Any ideas?
add_action('the_content_feed', 'remove_rss_links');
function remove_rss_links($content) {
return preg_replace(".*appeared first on.*$", "", $content);
}
Here is part of my feed (slightly redacted):
</p>
<p>The post <a rel="nofollow" href="http://foobar/tees/">Tees</a> appeared first on <a rel="nofollow" href="http://foobar">Golf Course Renovation</a>.</p>
]]></description>
Turns out I don't need to edit the RSS at all. The lines I'm looking to remove don't originate in WP at all. They come from a Yoast SEO feature, and it can be turned off in the options: SEO -> Search Appearance -> RSS