Skip to content

support attachment pages is disabled by default since 6.4, so why then offer image be viewed in attachment pages? #78100

Closed as duplicate

Description

@shreyasikhar

Description

Created the issue from here: https://core.trac.wordpress.org/ticket/65169, since the change is required on Gutenberg side too.

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

Step-by-step reproduction instructions

  1. Create a new page/post, or simply edit existing ones
  2. Try adding image block or gallery block
  3. Once added, try linking them. We will find an option to link it to attachment pages even if they are disabled. If these URLs are accessed, they redirects to attachment file URL.

Screenshots, screen recording, code snippet

No response

Environment info

No response

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

  • Yes

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure

Activity

  1. Mamaduka commented on May 8, 2026

    @Mamaduka
    Member

    This is a duplicate of #56019 and requires https://core.trac.wordpress.org/ticket/61133 before we move forward.

  2. added
    [Status] DuplicateUsed to indicate that a current issue matches an existing one and can be closed
    on May 8, 2026
  3. Mamaduka commented on May 10, 2026

    @Mamaduka
    Member

    Closing as a duplicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

[Status] DuplicateUsed to indicate that a current issue matches an existing one and can be closed[Status] In ProgressTracking issues with work in progress[Type] BugAn existing feature does not function as intended

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions