Where does the 404 redirection happen?

Based on your comments, I think I get what you’re saying. However, you don’t want to redirect on a 404, since it defeats the object of the ‘Not Found’ header.

However, you can filter the 404 template path and pass back your own;

function __custom_404( $standard_404 )
{
    if ( something_is_true() )
        return '/absolute/path/to/custom.php';
    return $standard_404;
}
add_filter( '404_template', '__custom_404' );

Leave a Comment