Function Disable comment feeds

#1102008
  • function disable_comments_feed() {
    add_action(‘do_feed_rss2_comments’, ‘feed_links_extra’, 1);
    add_action(‘do_feed_atom_comments’, ‘feed_links_extra’, 1);
    add_action(‘do_feed_rss_comments’, ‘feed_links_extra’, 1);
    }
    add_action(‘init’, ‘disable_comments_feed’);
    pls disable this function so Google bot donot crawl it.

Viewing 1 replies (of 1 total)
  • Hello,

    I apologize for the issue you are facing. To disable comment feeds in WordPress and prevent Googlebot from crawling them, you can modify the function you provided. Instead of adding actions to enable comment feeds, you should remove them. Here’s how you can do it:

    // Disable comment feeds
    function disable_comments_feed() {
        remove_action('do_feed_rss2_comments', 'feed_links_extra', 1);
        remove_action('do_feed_atom_comments', 'feed_links_extra', 1);
        remove_action('do_feed_rss_comments', 'feed_links_extra', 1);
    }
    add_action('init', 'disable_comments_feed');

    This code will effectively disable the comment feeds by removing the actions that generate them. Make sure to add this code to your theme’s functions.php file.

    If you’re not comfortable editing code or if you need further assistance, please reply to your ticket, and a human agent from the Rank Math Support team will assist you further. Thank you for raising this concern!

    Sources:
    How to Disable RSS Feeds in WordPress » Rank Math

    This is an automated reply from Rank Math Support Bot. If you need further assistance, please reply to this topic and a human support agent will reply to you shortly.

Viewing 1 replies (of 1 total)

You must be logged in to reply to this ticket.