I am moving content from an old site based on Wordpress 4.9 to a new website based on the current release and PHP 8. I have moved all the content - meaning posts, pages, media, and so forth - using Updraft and have spotted an interesting issue. Many of the posts have embedded galleries in them that are based on the builtin gallery feature of WP, nothing special.
When I create a new gallery in a post now, the anchor of the thumbnail is pointing to the media file, so for example, the link looks like mysite.com/media/image123.jpg
. When I click that, the image opens fine. However, galleries in the imported posts have links to the image that look like this: mysite.com/image123
, so some kind of permalink. When I click on a thumbnail with this link, instead of opening the image, it opens a separate page with nothing but the image on it - and only when I click on that, I get to the full size image.
What should I do to make the old galleries link directly to the media files? There is quite a lot of content, so I would like to avoid having to fix it manually in all posts.