WordPress is mainly known for its powerful blogging functions. People use RSS feeds to subscribe to new content you publish, as well as third-party reader applications, such as Feedly. So they can read your fresh content anytime, anywhere. However, not everyone uses the blog section of WordPress, and for some enterprises, in fact, they may just want to disable RSS Feeds completely in WordPress.
by default, WordPress generates various built-in RSS Feeds. For example,
http://example.com/feed/ http://example.com/feed/rss/ http://example.com/feed/rss2/ http://example.com/feed/rdf/ http://example.com/feed/atom/
also generates Feed for your categories, tags, comments, and so on.
WordPress there are several different ways to disable RSS Feeds in WordPress. You can do this using plug-ins or code.
uses plug-ins to disable RSS Feeds
- uses code to disable RSS Feeds
- 1. Using plug-ins to disable RSS Feeds
the first way to disable RSS Feeds for WordPress is to use a free plug-in such as Disable Feeds. This plug-in disables all RSS/Atom Feeds on the WordPress website by redirecting all requests. It also disables the BuddyPress group Feeds and the bbPress forum Feeds.
you can download Disable Feeds from the WordPress plug-in library or search under “plug-ins-install plug-ins” in the WordPress dashboard. You can then change the settings under the Settings-read section. By default, the plug-in redirects the request to its corresponding HTML content. For example, if visitors click on the RSS Feeds of the category, they will be directed to the archive page of the category. You can also choose to display only 404 errors and whether to disable global article Feeds and global comment Feeds.
Disable Feeds plug-in
Note: this plug-in only disables the source itself, and you still need to remove the link to the RSS source yourself in the WordPress theme or the corresponding sidebar and footer widget.
you can also use advanced plug-ins like perfmatters, which allow you to disable RSS Feeds and disable RSS Feeds links, as well as other optimizations to WordPress sites.
uses perfmatters to disable RSS Feeds
two。 The second way to disable RSS Feeds
with code to disable WordPress RSS Feeds is to simply use code.
warning! If done improperly, editing the source code of the WordPress theme may damage your website. It is recommended to back up the original file before operation.
copies the following code to the functions.php file of your subtheme.
now, if someone visits a RSS Feeds on your website, such as domain.com/feed, they will see the following message.
function itsme_disable_feed() { wp_die( __( 'No feed available, please visit the homepage!' ) ); } add_action('do_feed', 'itsme_disable_feed', 1); add_action('do_feed_rdf', 'itsme_disable_feed', 1); add_action('do_feed_rss', 'itsme_disable_feed', 1); add_action('do_feed_rss2', 'itsme_disable_feed', 1); add_action('do_feed_atom', 'itsme_disable_feed', 1); add_action('do_feed_rss2_comments', 'itsme_disable_feed', 1); add_action('do_feed_atom_comments', 'itsme_disable_feed', 1);
RSS Feeds warns
WordPress that it will also generate a link to RSS Feeds in the title of your web page, as shown on the following screen. You can go a step further by removing these links from the page’s HTML code. RSS Feeds
in the
WordPress title copies the following code to your functions.php file to remove the title link to RSS Feeds.
将以下代码复制到您的functions.php文件中,以删除指向RSS Feeds的标题链接。
remove_action( 'wp_head', 'feed_links_extra', 3 ); remove_action( 'wp_head', 'feed_links', 2 );