WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] How do I remove RSS Feed and Comments from header?

[Resolved] How do I remove RSS Feed and Comments from header?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Man, learn to post correctly your blog’s link – it is : after http, not .

    Did you look around in your theme’s directory? If you want to edit something in the header, shouldn’t be the logical thing to look into the header.php?

    markcolclough
    Member

    @markcolclough

    hi there

    sorry, I have now edited the link above…

    Yes I have looked around header.php and I have removed

    <div id="feedarea">
    <dl>
    	<dt><strong><?php _e('Feed on','ml');?></strong></dt>
    	<dd><a href="<?php bloginfo('rss2_url'); ?>"><?php _e('Posts','ml');?></a></dd>
    	<dd><a href="<?php bloginfo('comments_rss2_url'); ?>"><?php _e('Comments','ml');?></a></dd>
    </dl>
    </div><!-- end id:feedarea -->

    but that didn’t do the trick…

    any ideas?

    Thank you for your time
    Mark

    markcolclough
    Member

    @markcolclough

    OK, I checked and that’s all I need to do

    Thank you Moshu for pointing me in the right direction

    Mark

    iphonethesolution
    Member

    @iphonethesolution

    Go to your theme and paste this in your function.php

    /**
     * Disable Our Feed Urls
     */
    function disable_our_feeds() {
    	wp_die( __('<strong>Error:</strong> No RSS Feed Available, Please visit our <a href="'. get_bloginfo('url') .'">homepage</a>.') );
    }
    
    add_action('do_feed', 'disable_our_feeds', 1);
    add_action('do_feed_rdf', 'disable_our_feeds', 1);
    add_action('do_feed_rss', 'disable_our_feeds', 1);
    add_action('do_feed_rss2', 'disable_our_feeds', 1);
    add_action('do_feed_atom', 'disable_our_feeds', 1);

    This will disable all rss feeds and atoms.

    Regards,

    [sig link moderated]

    squareink
    Member

    @squareink

    Hi

    I tried this (using autofocus theme) and it doesn’t remove it for me… I have however found where the rss code is:

    function sandbox_globalnav() {
    	echo '<div id="menu"><ul><li class="page_item"></li>';
        $menu = wp_list_pages('title_li=&sort_column=menu_order&echo=0'); // Params for the page list in header.php
        echo str_replace(array("\r", "\n", "\t"), '', $menu);
    	echo '<li class="page_item"><a href="'. get_bloginfo_rss('rss2_url') .'">RSS</a></li></ul></div>';
    }

    Any ideas of what to comment out/ delete/ move? as I’ve tried a few things but not very good with the php code…

    many thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Resolved] How do I remove RSS Feed and Comments from header?’ is closed to new replies.