Disable WordPress Feed & Redirect to Homepage

You can totally disable WordPress feed by using a few lines of code. If feeds are totally useless for your website then we recommend you to follow the steps. Perhaps you can also check this removing Feed URLs from header source code too.

Open your function.php file via any code editor. Then paste the following code inside your function.php file. Make sure you are editing your active theme function.php file.

				
					// Totally disable Feeds
add_action('do_feed', 'jltwp_adminify_redirect_feed', 1);
add_action('do_feed_rdf', 'jltwp_adminify_redirect_feed', 1);
add_action('do_feed_rss', 'jltwp_adminify_redirect_feed', 1);
add_action('do_feed_rss2', 'jltwp_adminify_redirect_feed', 1);
add_action('do_feed_atom', 'jltwp_adminify_redirect_feed', 1);

// Redirect function
function jltwp_adminify_redirect_feed($url = false)
{
    if ($url) {
        $target = $url;
    } else {
        $target = get_option('siteurl');
    }

    $target = 'Target URL Here';
    $status = '301';

    wp_redirect($target, 301);
    die();
}

				
			

Disable WordPress feed in WP Adminify

First navigate to the WP Adminify tweaks option page. Then click on “Feed”, you will see “Totally Disable Feed” option there. Just enable it. Enabling this option will disable the functionality of the feed. If someone try to visit your feed URL, the system will redirect to the homepage.

totally disable feeds in WordPress
Was this article helpful?

© 2021-2024 - Adminify | All rights reserved

WP Adminfy accepted payment methods