I'm creating my own custom taxonomy rss feeds and have added those sucessfully to the head on term pages. Now, however, I need to remove the core taxonomy feed from those pages (currently it shows 2 feeds: the custom feed and the core feed).
Many people have suggested simply using the taxonomy view which overrides the core term and feed displays, but for complex reasons I can't use this solution.
I need to programmatically remove the feed from the head.
The original feed in the page head looks like this:
<link rel="alternate" type="application/rss+xml" title="RSS - termname" href="/taxonomy/term/2764/0/feed">
My best attempt to remove this is done in template.php and shown below, but it doesn't work:
mytheme_preprocess_page(&$variables) {
//target taxonomy term pages
if(arg(0) == 'taxonomy' && arg(1) == 'term' && is_numeric($arg2)) {
$variables['head'] = preg_replace('/<link rel="alternate" type="application\/rss\+xml" title=".*?" href=".*?">/', '', $variables['head']);
}
}
I probably need to get even more specific on the 'href' portion as well, so it only removes the term feed...but I haven't gotten that far yet.
I also tried adding $variables['head'] = drupal_get_html_head();
at the end just to reload the head, in case it was necessary, and that doesn't help.
How can I programmatically remove this feed?