If someone can help to remove a class from my RSS feed in WordPress, completely I want to remove below code from my RSS feed.
<div class="well"> <a class="btn" href="foo.com">foo</a></div>
If noticed well, there could be done via function. If you know the trick please share your solution.
Thanks in advance, Gregory
Try this
add_filter('the_excerpt_rss', 'remove_sc_rss_feed');
function remove_sc_rss_feed( $content )
{
global $post;
// Remove div with class using regex
$content = preg_replace('#<div class="well">(.*?)</div>#', '', $post->post_content);
return $content;
}
Note: You might not see the changes immediately. Wordpress RSS feeds cache for a few hours. I'd suggest installing a caching plugin and not cache the feed. I think this plugin will do it https://wordpress.org/plugins/w3-total-cache/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.