Last active
September 12, 2023 19:22
-
-
Save onecooltaco/91889570ee10b21babe4c4d5da8bf31e to your computer and use it in GitHub Desktop.
WordPress mu plugin to disable RSS feeds in WordPress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/*** | |
Plugin Name: disable RSS feeds | |
Plugin URI: https://gist.github.com/onecooltaco/91889570ee10b21babe4c4d5da8bf31e | |
Description: Disable RSS feeds in WordPress | |
Version: 1.0.0 | |
Author: Jeremy Leggat | |
***/ | |
/* | |
This program is free software; you can redistribute it and/or modify | |
it under the terms of the GNU General Public License, version 2, as | |
published by the Free Software Foundation. | |
This program is distributed in the hope that it will be useful, | |
but WITHOUT ANY WARRANTY; without even the implied warranty of | |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
GNU General Public License for more details. | |
You should have received a copy of the GNU General Public License | |
along with this program; if not, write to the Free Software | |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
*/ | |
// Disable RSS feeds in WordPress. | |
function oct_disable_feed() { | |
wp_die( __('No feed available,please visit our <a href="'. get_bloginfo('url') .'">homepage</a>!') ); | |
} | |
add_action('do_feed', 'wpb_disable_feed', 1); | |
add_action('do_feed_rdf', 'wpb_disable_feed', 1); | |
add_action('do_feed_rss', 'wpb_disable_feed', 1); | |
add_action('do_feed_rss2', 'wpb_disable_feed', 1); | |
add_action('do_feed_atom', 'wpb_disable_feed', 1); | |
add_action('do_feed_rss2_comments', 'wpb_disable_feed', 1); | |
add_action('do_feed_atom_comments', 'wpb_disable_feed', 1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment