change default RSS feed URL

I need to change the default rss url of my website:

from example.com/feed to example.com/MyfeedName

Update:

what i tried so far is to create another Url feed but i need to remove firstexample.com/feed:

add_action( 'init', function()
{
add_feed( 'secretfeed', 'do_feed_rss2' );
});

add_action( 'pre_get_posts', function( \WP_Query $q )
{
if( $q-is_feed( 'secretfeed' ) )
    add_filter( 'option_rss_use_excerpt', '__return_false' );

 } );

do you have any idea how to just edit example.com/feed or how to delete it without losing rss functions?

Topic rss php urls Wordpress

Category Web


I found my answer here : https://wordpress.stackexchange.com/a/214883/71314

function remove_feed( $feedname ) {
    global $wp_rewrite;

    if ( in_array( $feedname, $wp_rewrite->feeds ) ) {
            $wp_rewrite->feeds = array_diff( $wp_rewrite->feeds, array( $feedname ) );
    }

    $hook = 'do_feed_' . $feedname;

    // Remove default function hook
    remove_all_actions( $hook );
    add_action( $hook, $hook );

    return $hook;
}

Usage:

remove_feed( 'feed' );

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.