[wp-trac] [WordPress Trac] #65169: support attachment pages is disabled by default since 6.4, so why then offer image be viewed in attachment pages?
WordPress Trac
noreply at wordpress.org
Tue May 5 17:42:04 UTC 2026
#65169: support attachment pages is disabled by default since 6.4, so why then
offer image be viewed in attachment pages?
---------------------------+-----------------------------
Reporter: ignatiusjeroe | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: trunk
Severity: normal | Keywords:
Focuses: template |
---------------------------+-----------------------------
I've been playing around in the block editor.
in the image/gallery block toolbar a hyperlink can be added (see link
icon)to the image/gallery. Option 'link to attachment page' doesnt work as
expected. It just opens the media file directly instead of using the
attachment template. This is caused by the settings option
'''wp_attachment_pages_enabled''' that has been set to 0 since WP 6.4.
This causes function redirect_canonical(...) to redirect to the attachment
source instead of returning the attachment template.
My question is, why is the usage of attachment pages disabled by default
when in different pages the option to use attachment pages is still
offered? There is also no notice given (in the image/gallery toolbar) that
the option might not work due to the disabling of
''wp_attachment_pages_enabled''.
Another place in the backend were this is an issue is the media edit page.
The media permalink clearly points to the attachment page. But when
clicked the media file is directly opened.
My suggestion is:
- either turn back on the support of the usage of attachment pages
- add an option to the Settings page with which the admin can
enable/disable support for use of attachment pages
- disable the option 'link to attachment page' in the image/gallery block
toolbar
--
Ticket URL: <https://core.trac.wordpress.org/ticket/65169>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list