Stopping media file redirects October 23, 2022 by Tarik Billa This fixes the problem: remove_action('template_redirect', 'redirect_canonical');