RSS Feed Page

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

WordPress &rsaquo; Error No feed available, please visit our <a href="https://www.mysitesurl.net">homepage</a>! 500

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

Hi Brad,

Please note that this is something that goes beyond the scope of our support since we are dealing with some custom codes and functionalities that are not related to the theme.

However, the suggestion from this link might help:

Hope this helps.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.