Function Disable comment feeds

#1102008
  • Resolved Ijaz Hussain
    Rank Math free

    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.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 1 replies (of 1 total)

The ticket ‘Function Disable comment feeds’ is closed to new replies.