If someone can help to remove a div from my RSS feed. I want to remove below code from my RSS feed.
<div class="well"> <a class="btn" href="foo.com">foo</a></div>
Thanks in advance, Gregory
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.
Sign up to join this communityYou can use the_content_feed
hook for that. It is used to filter the content of the post after it is retrieved from the database and filtered by "the_content" and before it is sent to RSS reader (or browser).
So here's the code:
add_filter( 'the_content_feed', function ( $content ) {
$content = str_replace( '<div class="well"> <a class="btn" href="foo.com">foo</a></div>', '', $content );
return $content;
} );
return $content;
to return $content . 'adfkjslfjdlasd';
- do you see 'adfkjslfjdlasd' in the feed? 2. Change 'the_content_feed' to 'the_content' - do you see the div removed directly on the site?