Hi,
I’ve been using a plugin to block access to my sites RSS feeds. It’s no longer being maintained so I found a code for my functions.php file to limit access. The code works but rather than show a message, it just shows raw code:
This XML file does not appear to have any style information associated with it. The document tree is shown below.
wp_die
Here is the code I placed in my functions php:
function rss_disable_feed() {
wp_die( __( ‘No feed available, please visit the homepage!’ ) );
}
add_action(‘do_feed’, ‘rss_disable_feed’, 1);
add_action(‘do_feed_rdf’, ‘rss_disable_feed’, 1);
add_action(‘do_feed_rss’, ‘rss_disable_feed’, 1);
add_action(‘do_feed_rss2’, ‘rss_disable_feed’, 1);
add_action(‘do_feed_atom’, ‘rss_disable_feed’, 1);
add_action(‘do_feed_rss2_comments’, ‘rss_disable_feed’, 1);
add_action(‘do_feed_atom_comments’, ‘rss_disable_feed’, 1);
remove_action( ‘wp_head’, ‘feed_links_extra’, 3 );
remove_action( ‘wp_head’, ‘feed_links’, 2 );
Any help would be great! and if it can’t display the message properly can I have it redirect to my homepage instead while still blocking the feed?
Thanks
Brad