-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Attachment Page" is still listed as a link to option for Image Block when Attachment Pages are disabled #56019
Comments
I may be wrong but it seems this option is not exposed to the block editor. I have not created custom REST API end points in a few years so I will remove my assignment. |
Exposing the Maybe the I reposted my question in the original Trac ticket: https://core.trac.wordpress.org/ticket/57913#comment:76. |
@Mamaduka I think removing the |
@peterwilsoncc, that's one possibility, but I don't want to introduce yet another block editor setting if that's possible. One alternative I can think of is adding a new link via @TimothyBJacobs, do you think I should give up on REST API modifications and just go with global block editor settings? 😄 |
My gut would be to remove the link from the response as well. I think it's unexpected that we link to the attachment page via the REST API, if that page won't actually work. Maybe instead of completely removing the prop, we set it to an empty string? |
@TimothyBJacobs @Mamaduka What about setting the The block editor could then determine whether to show the attachment page link by comparing My testing shows that a REST request is made for the media prior to the dropdown being displayed, please correct me if that is not always the case. |
I think this is the key
|
This makes sense to me. Looking at the |
I was just testing this logic. Unfortunately, it won't work. The Example returned values:
It also looks like the component responsible for rendering Link URL options for images already accounted for empty It seems to me that @TimothyBJacobs suggestion is the right way to handle this. |
I was chatting with @peterwilsoncc some, and we're wondering if the correct place we should be patching is the |
@TimothyBJacobs, @peterwilsoncc, sounds good to me. Once there's a working patch for the core, I can update the Gutenberg code. |
I've created WP#61133 to update the return value for |
Description
6.4 brought us the ability to disable Attachment Pages (and new sites are created without them).
However, even when Attachment Pages are disabled, I am shown "Attachment Page" as an option when setting the link of an Image Block.
Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
Environment info
WordPress 6.4.1, no Gutenberg plugin
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
The text was updated successfully, but these errors were encountered: