Skip to content

Instantly share code, notes, and snippets.

@bobbydank
Created October 12, 2023 16:48
Show Gist options
  • Save bobbydank/41db5cc4bc2f28ac4bc8eb35b2bb3aee to your computer and use it in GitHub Desktop.
Save bobbydank/41db5cc4bc2f28ac4bc8eb35b2bb3aee to your computer and use it in GitHub Desktop.
removes rss feeds from wordpress
<?php
function cl_itsme_disable_feed() {
wp_die( __( 'No feed available, please visit the <a href="'. esc_url( home_url( '/' ) ) .'">homepage</a>!' ) );
}
add_action('do_feed', 'cl_itsme_disable_feed', 1);
add_action('do_feed_rdf', 'cl_itsme_disable_feed', 1);
add_action('do_feed_rss', 'cl_itsme_disable_feed', 1);
add_action('do_feed_rss2', 'cl_itsme_disable_feed', 1);
add_action('do_feed_atom', 'cl_itsme_disable_feed', 1);
add_action('do_feed_rss2_comments', 'cl_itsme_disable_feed', 1);
add_action('do_feed_atom_comments', 'cl_itsme_disable_feed', 1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment