WordPress.org

Ready to get started?Download WordPress

Forums

Disable Comments RSS Feed in wp_head (15 posts)

  1. punkyb9
    Member
    Posted 5 years ago #

    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?

  2. punkyb9
    Member
    Posted 4 years ago #

    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');
  3. Soundofsirens
    Member
    Posted 4 years ago #

    Sorry. This doesn'T work. I'm using WP 2.8.4 - any ideas?

    Help is very much apreciated,
    m.

  4. stml
    Member
    Posted 4 years ago #

    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: http://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.

  5. swedish boy
    Member
    Posted 4 years ago #

    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...

  6. yorokobi
    Member
    Posted 4 years ago #

    Punkyb9's code worked fine for me. Running 2.8.4

  7. dangayle
    Member
    Posted 4 years ago #

    @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.

  8. hoekiesda
    Member
    Posted 4 years ago #

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

  9. blogger tools
    Member
    Posted 4 years ago #

    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.

  10. naviarora
    Member
    Posted 4 years ago #

    i am also getting error with punky's code

    Fatal error: Call to undefined function add_filter()

  11. Hatticus
    Member
    Posted 4 years ago #

    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.

  12. hoekiesda
    Member
    Posted 4 years ago #

    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');
  13. kingwm
    Member
    Posted 4 years ago #

    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.

  14. kingwm
    Member
    Posted 4 years ago #

    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.

  15. conualfy
    Member
    Posted 4 years ago #

    I've got a problem with comments feed on http://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!

Topic Closed

This topic has been closed to new replies.

About this Topic