Close

Désactiver les flux RSS/Atom/RDF de WordPress

Quelques fois, il est nécessaire de désactiver les flux de sites WordPress.

Le code ci-dessous se place dans le fichier functions.php de votre thème.
Ce code :

  • désactive les flux RSS
  • retire les en-tête du code HTML
function disable_all_feeds() {
   wp_redirect('');
}
add_action('do_feed', 'disable_all_feeds', 1);
add_action('do_feed_rdf', 'disable_all_feeds', 1);
add_action('do_feed_rss', 'disable_all_feeds', 1);
add_action('do_feed_rss2', 'disable_all_feeds', 1);
add_action('do_feed_atom', 'disable_all_feeds', 1);
add_action('do_feed_rss2_comments', 'itsme_disable_feed', 1);
add_action('do_feed_atom_comments', 'itsme_disable_feed', 1);

remove_action( 'wp_head', 'feed_links_extra', 3 );
remove_action( 'wp_head', 'feed_links', 2 );

Leave a Reply

Your email address will not be published. Required fields are marked *