How to Remove an HTML tag from XML feed in WordPress

So I have an xml feed that is for some reason displaying a price tag (I don’t even know if this is a valid HTML tag and it is displayed as “price/” in angle brackets of course) under each individual blog post causing the feed not to validate (displaying 65 times). I would like to remove this from the feed and tried adding this piece of code to the functions.php file:

function rss_nopricetag($content) {
$content = preg_replace( '/<price/>/is', '', $content );

return $content;
}

add_filter('the_excerpt_rss', 'rss_nopricetag');
add_filter('the_content_feed', 'rss_nopricetag');

To no avail, I am using the below code to remove the tag from my feed and it is working just fine.

Read More
function rss_noiframe($content) {
$content = preg_replace( '/<iframe(.*)/iframe>/is', '', $content );

return $content;
}

add_filter('the_excerpt_rss', 'rss_noiframe');
add_filter('the_content_feed', 'rss_noiframe');

What could I be doing wrong?

Related posts

Leave a Reply

1 comment