0

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?

1 Answer 1

1

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' );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.