Skip to content

Conversation

@yogeshbhutkar
Copy link
Contributor

@yogeshbhutkar yogeshbhutkar commented Jun 13, 2025

What?

Closes #70403

WP 6.4 introduced the database option wp_attachment_pages_enabled to control visibility/generation of attachment pages (Ref. https://make.wordpress.org/core/2023/10/16/changes-to-attachment-pages/ )

This PR uses the above option to conditionally render the "Link to attachment page" option within the ImageURLInputUI component.

Why?

Currently, the Image block always displays the "Link to attachment page" option, even when wp_attachment_pages_enabled is set to 0 (i.e., attachment pages are disabled).

How?

This PR exposes the wp_attachment_pages_enabled setting to the editor and uses it to conditionally display the "Link to attachment page" option in the Image block.

Testing Instructions

  1. Confirm that wp_attachment_pages_enabled is set to 0 (i.e., disabled).
  2. Create a new post.
  3. Insert a core/image block and attach an image.
  4. From the Link Control within Block Toolbar, verify that the Link to attachment page option is not present.
  5. Toggle wp_attachment_pages_enabled to 1 and confirm that the Link to attachment page is now accessible.

Testing Instructions for Keyboard

Same.

Screenshots

Before After
before after

@t-hamano
Copy link
Contributor

@yogeshbhutkar Thanks for working on this issue.

Before tackling this problem, we may want to read #56019 and consider what approach we should take.

@t-hamano t-hamano added [Type] Bug An existing feature does not function as intended [Block] Image Affects the Image Block labels Jun 13, 2025
@yogeshbhutkar
Copy link
Contributor Author

Based on the developments in the discussion within the tagged issue, I think it's appropriate to close this PR, as introducing the option as a block editor setting has been ruled out.

@yogeshbhutkar yogeshbhutkar deleted the fix-70403/editor-attachment-page branch June 16, 2025 03:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Block] Image Affects the Image Block [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Image block link control shows attachment page option even if attachment pages are disabled

2 participants