If a photo in WordPress opens with the site header, a title, and almost no text, you are probably looking at an attachment page. This is a separate HTML address. The image file itself is usually in the uploads folder and opens without the theme’s layout. Deleting the photo from the media library to make this page disappear can break images in your posts.
Start with two URLs: the attachment page and the file. Then choose the behavior you want for the page. It varies across WordPress installations: the site’s age and SEO plugin settings matter.
How to tell what you opened
Copy the full URL of the problem page. View the source code in your browser: an HTML page has a document with a head and body, while a direct file contains the image. The extension in the address is a clue, but you can confirm the response type in your browser’s developer tools on the Network tab: reload the address and check the Content-Type of the main request.
Then open the post that uses the photo. Click the image and check where its link goes. It may lead to the file, an attachment page, a custom URL, or nowhere at all. The same photo can have different links on different pages because those links were set in each post’s editor.
Note how the visitor reached the empty page: from a post, a catalog, search results, or an old link. These are different paths to fix. The attachment page setting changes how the URL behaves, while the link in the post determines where someone goes when they click the photo.
Why new and old WordPress installations behave differently
In WordPress 6.4, attachment pages were disabled by default for new installations. The previous behavior was retained for existing installations. This distinction is described in the WordPress developer overview of the changes. So you cannot compare an updated old site with a fresh installation based on the version number alone.
Developers may find the parameter name wp_attachment_pages_enabled useful: it lets them check the state of a specific database. Site owners do not need to change database tables themselves. Ask the developer to record the current value and explain which layer controls the behavior: WordPress, an SEO plugin, or a separate redirect rule.
If a new site still opens HTML pages for photos, that does not prove there is a core bug. The behavior may have been enabled later or changed by a plugin. If an old site redirects attachments, that may also be due to a setting. Check the final response for the specific URL rather than making assumptions based on the installation’s age.
A worked example with an installation photo
Imagine a site where the post /projects/office/ shows a photo of ventilation. The file is at /wp-content/uploads/2026/10/office.jpg, and the photo links to /projects/office/office-photo/. This example is fictional and is intended to explain the URLs.
The empty photo page repeats the project name but contains no useful description of the work. The site owner decides that clicking the image should open the photo itself, and that the attachment page should not be used as a standalone piece of content. The task should have two outcomes: the link in the post is corrected, and the old HTML address returns the desired response.
If the photo comes with a substantial original analysis, the decision may be different. A page with a technical description, diagram, and explanation does not become useless just because it was originally an attachment. Assess the content and existing links first, then choose a redirect or a separate post.
Where to change the behavior in Yoast SEO
In the current version of Yoast, go to Yoast SEO → Settings → Advanced → Media pages. When Enable media pages is switched off, attachment pages redirect to the media file. The path and behavior are described in the official Yoast guide. The labels may differ in the Russian localization; look for the media pages section.
Before changing the setting, record its current state and test one page on a copy of the site. After saving, reopen the old attachment URL and check the final address. If the browser shows the photo, also confirm that it is the same file used by the post, not a different image by mistake.
This setting does not promise to send visitors to the parent post. Older guides describe different behavior from previous versions of Yoast. Do not choose a solution based on a screenshot from one of those guides. If you specifically need to redirect to a post, the developer should separately map attachments to their target content and handle photos that do not have a parent post.
What to change in links within your content
After changing the URL behavior, check the post editor. If your goal is to let people view the full-size photo, choose a link to the media file. If the image is just an illustration with no click-through, remove the link. If it is a project card, link it to the project. Do not change all images in the same way: they may serve different purposes.
Be sure to check the published post again. A click should go where you intended, and the image should display on both desktop and mobile. Also check the caption, alt text, and photo loading. Changing the link alone does not require deleting the file or uploading another copy.
For a large library, prepare a sample that includes an attachment with a post, a photo without a parent post, a product image, and an old attachment found through search. Start bulk processing only after confirming how all these cases should be handled. The absence of a link in one post does not mean the HTML address is unused anywhere else.
What this setting changes about the file itself
Redirecting an attachment’s HTML page does not mean that the image file itself is blocked from indexing. If your goal is to restrict access to the file, that is a separate task with different rules. In our check, the photo should remain accessible and be used in the post. So if office.jpg opens after media pages are switched off, do not treat that as an error: it is the intended behavior, which still needs to be confirmed.
How to verify the fix and write up the task
Give the developer a table with these columns: “attachment page — file — where it is used — desired action.” In the worked example, include both URLs and this rule: the photo in the project opens the file, the old attachment URL redirects to that same file, and the image in the post remains accessible.
Accept the work based on four observations: the attachment page response, the final URL, whether the image displays correctly in the post, and whether any new broken links have appeared. If you had useful media pages, check those separately. They should not disappear just because empty pages were found nearby.
A check in Google or Yandex shows the state of their index, which may reflect information collected before the fix. Until a recrawl is confirmed, record: “site behavior fixed, search changes not verified.” This is more accurate than promising that all photos will disappear from search tomorrow.
For other types of archive pages, see the separate guide to WordPress tag archives: their rules should not automatically be applied to images.
You can also check which pages are available using the WordPress sitemap guide, and check for related link errors with a technical audit. For the photo itself, the outcome is simple: the file is preserved, the link is clear to visitors, and the unnecessary HTML address responds according to the chosen rule.