Open marincarroll opened 8 months ago
Thanks for reporting, this is an interesting one.
I'm personally not sure it's a bug, the implementer of Link Control can check the available post types before specifying the prop (using wp.data.select( 'core' ).getPostTypes()
). The LinkControl
component could also do this internally, but I think it would be overkill for lots of use cases to make it the default.
I think there's also an argument that the REST API response isn't great (completely failing to work for a minor misconfiguration), but that's not something that can be fixed in the Gutenberg project, it'd require a WordPress core change (and so a ticket in trac - https://core.trac.wordpress.org/).
Hi, This issue has gone 30 days without any activity. This means it is time for a check-in to make sure it is still relevant. If you are still experiencing this issue with the latest versions, you can help the project by responding to confirm the problem and by providing any updated reproduction steps. Thanks for helping out.
Description
LinkControl's suggestionsQuery allows you to add multiple post types by giving the
subtype
property a comma-separated list of post type slugs. However, if one of those post types is not registered, it's seen as an invalid parameter with a 400 response and no suggestions will show.Step-by-step reproduction instructions
Example – this works when 'other-type' is registered, otherwise 400s.
Screenshots, screen recording, code snippet
Environment info
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
No