0

I would like to change wordpress feed url. After a little research I find this function (check below).

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;
}

But I don't know how to use this function. Is there any one who can explain it?

5
  • 1
    can you give an example?
    – birgire
    Commented May 29, 2022 at 17:01
  • please check it out - wordpress.stackexchange.com/questions/162811/… Commented May 31, 2022 at 3:28
  • I mean what are those url you want to change, before and after?
    – birgire
    Commented May 31, 2022 at 15:40
  • any url! like: sitename.com/randomtext Commented Jun 1, 2022 at 7:49
  • sorry I'm a little confused, the title of the question mentioned changing the feed url, the body of the question has a code to remove the feed url and in comment you mentioned changing any url. Can you please update the question with more information, to increase the change of others giving a helpful answer. Thanks - ps: normally you can put custom code in the functions.php file of your (child) theme or as a custom plugin.
    – birgire
    Commented Jun 1, 2022 at 11:19

0

Your Answer

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

Browse other questions tagged or ask your own question.