• Resolved rrecurse

    (@rrecurse)


    When selecting the option:

    Issue a Page Not Found (404) error for feed requests

    … a request for https://domain.com/feed/ renders the view:source of the 404 page, as if it’s parsed with <pre> tags. It does not render the template.

    The other redirect option does work as advertised.

    I would suggest a modification to the else condition on lines 134’ish by changing:

    else {
        $wp_query->is_feed = false;
        $wp_query->set_404();
        status_header( 404 );
    }

    to:

    else {
        $wp_query->is_feed = false;
        $wp_query->set_404();
        status_header( 404 );
        wp_redirect(home_url('404'), 302);
        exit();
    }

    Works by forwarding the user requesting domain.com/feed/ to domain.com/404 – ideally it should 404 without the URL rewrite, but for now this should work with most WP installs.

    Hope this helps others.

    https://www.ads-software.com/plugins/disable-feeds/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Samir Shah

    (@solarissmoke)

    Thanks for reporting this. I have just pushed a fix in version 1.4.3.

    The problem was that WordPress sets a Content-Type header for feeds that breaks if you then don’t actually render a feed (I reported the bug many years ago…).

    I’ve taken a different approach to what you suggested and just reset the Content-Type header. It should work now.

    Thread Starter rrecurse

    (@rrecurse)

    Great an thank you for resolving!

    I can confirm 404 option is now behaving as expected.

    Cheers!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Show 404 option not working correctly.’ is closed to new replies.