How to disable Wordpress automatic redirection

#253557
  • Resolved Stylus Design
    Rank Math free

    Hello,

    Following my previous ticket,
    https://support.rankmath.com/ticket/google-redirects-old-url/

    is there any way I could disable WordPress automatic redirection? I’m trying to delete unnecessary pages ASAP and Google takes for a while to update data in GSC. Once all unnecessary pages gone I will activate it again.

    I looked for a solution on the net but saw some different suggestions, hard to tell which one is the best for me.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello,

    Thanks for contacting us. Sorry for the delay and any inconvenience that might have been caused due to that.

    You can use the filter given below in your theme’s functions.php file to disable the auto-redirect from WordPress:

    add_filter('redirect_canonical', 'no_redirect_on_404');
    function no_redirect_on_404($redirect_url)
    {
        if (is_404()) {
            return false;
        }
        return $redirect_url;
    }

    Hope this helps. Let us know if you need any further assistance.

    Thank you for your help, I will add the code and let you know how it goes.

    Hello,

    We are looking forward to hearing from you.

    Please don’t hesitate to get in touch in case you need any other assistance.

    Thanks.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)

The ticket ‘How to disable Wordpress automatic redirection’ is closed to new replies.