• Resolved tea23hah

    (@tea23hah)


    Hi,

    great plugin.

    When I select Posts, Pages and Media in “Exclude Post Type(s)”

    and

    check the box “Disable Taxonomy Redirection”

    all 404s should go to the homepage, correct?

    Would be nice to just add this as an extra field like “Redirect all 404s to fallback”.

    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    Well… This defeat the whole purpose of the plugin haha! ??

    You don’t even need a plugin to do that, just add the following code to your functions.php:

    
    add_action('template_redirect', 'redirect_404_to_homepage', 999);
    function redirect_404_to_homepage(){
    
        if(!is_404())
            return;
    
        wp_redirect(home_url());
        exit;
    
    }
    

    Regards.

    Thread Starter tea23hah

    (@tea23hah)

    Thanks a lot for your help!

    The snippet results in a 302 redirect though, how would I change it to 301?

    I know, that’s not really related to your plugin anymore, but would appreciate your help anyway!

    Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello!

    Yes, use wp_redirect(home_url(), 301); ??

    Regards.

    Thread Starter tea23hah

    (@tea23hah)

    Amazing, thank you so much!

    Plugin Author Konrad Chmielewski

    (@hwk-fr)

    You’re welcome buddy ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Redirect all 404s to Homepage’ is closed to new replies.