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.
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?
Try escaping the slash in the price regex.