• I have a site that is run like a CMS and will use the general RSS feeds but doesn’t have commenting, so I don’t want there to be a Comments RSS feed available. It seems as though the link to that feed is generated in the wp_head code, is there a way to remove that link while still calling wp_head?

Viewing 14 replies - 1 through 14 (of 14 total)
  • Thread Starter punkyb9

    (@punkyb9)

    For anyone wondering, just add the following in your functions.php file:

    function remove_comments_rss( $for_comments ) {
        return;
    }
    add_filter('post_comments_feed_link','remove_comments_rss');

    Sorry. This doesn’T work. I’m using WP 2.8.4 – any ideas?

    Help is very much apreciated,
    m.

    I wrote a quick plugin that does this. Copy and paste the following into a file called stml_beheader.php in your plugins folder and activate.

    //////////////////////////////////////////

    <?php
    /*
    Plugin Name: STML Beheader
    Description: Removes unneccesary stuff from wp_head
    Author: James Bridle
    Version: 1.0
    Author URI: https://shorttermmemoryloss.com

    */

    remove_action( ‘wp_head’, ‘feed_links_extra’, 3 );
    ?>

    //////////////////////////////////////////

    You can remove other unwanted stuff as well by adding lines like:

    remove_action(‘wp_head’, ‘wlwmanifest_link’);
    remove_action(‘wp_head’, ‘rsd_link’);

    Hope that works for you.

    I succeeded to remove RSS by commenting line 66 inside wp-includes/feed.php:

    function get_default_feed() {
    	//return apply_filters('default_feed', 'rss2');
    }

    My blog seems to work fine, but I haven’t thoroughly tested it.
    Please note that this probably has to be done on each WordPress update…

    Punkyb9’s code worked fine for me. Running 2.8.4

    @soundofsirens

    Your RSS feed might be hard-coded into your theme, in which case the filter demonstrated by punkyb9 won’t work. Double check your header.php file.

    hoekiesda

    (@hoekiesda)

    Punkyb9’s code is a nice solution. How do I apply it for the (also useless) tag feed?

    blogger-tools

    (@blogger-tools)

    Thank you punkyb9 for providing the solution for this question. It worked for me using WordPress 2.8.6

    For anyone wondering how this works, and for the people who mentioned it didn’t work; make sure you add punkyb9’s code to your Theme Functions file (functions.php) located inside the folder of your active theme.

    i am also getting error with punky’s code

    Fatal error: Call to undefined function add_filter()

    I’ve used punkyb9’s code and it’s working fine. However, I’d also like to disable the Category feeds, as I’ve hardcoded in the only feeds I want to use. I’d imagine that this is possible in a similar way to the comments, but I have no idea what code to use.

    punkyb9’s code might work fine. Yet, having a look at function post_comments_feed_link in wp-includes/link-template.php, this works better:

    function remove_comments_rss( $for_comments ) {
        return '';
    }
    add_filter('post_comments_feed_link_html','remove_comments_rss');

    punkyb9 that code did not work for me using the fluid blue template and WP 2.9.2. i am still working on a fix.

    have not investigated this yet, but it looks promising. looks like a simple hack to your theme’s functions.php file

    link

    the last link referenced this article, which has another explanation.

    link

    I have tried several hacks on my blog and am waiting to see if google reader picks them up since i know no other way to test if feeds are on or off. I will come back and let you know how it works out.

    I’ve got a problem with comments feed on https://drumliber.ro

    Instead of seeing a page or article, sometimes (quite often) I get the comments feed of another random article. It’s completely random, I cannot see a rule for this bug.

    It might be a server problem, but there should be a way to fix it in the application. A way should be to check if the link in the address bar contains /feed and only then to show a feed. How can one do that?

    Thanks a lot!

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Disable Comments RSS Feed in wp_head’ is closed to new replies.