UrlInput component only suggests posts, not pages.
Issue Overview
The UrlInput component only suggests posts, not pages, when a user starts to enter text. In the code in /blocks/url-input/index.js, only /wp/v2/posts is being queried. I believe that /wp/v2/pages should be queried as well.
Steps to Reproduce
I first noticed this issue in the Button block, but this issue exists in any block that uses the UrlInput component.
- Create a new post/page and add the Button block.
- Start typing in the title of a page. Note that you will not see a suggestion for that page or any other page.
- Start typing in the title of a post. Note that you do see suggestions for that posts and other posts.
Expected Behavior
The UrlInput field should suggest posts of all post types (posts and pages).
I’d go as far as saying it should also include custom post types which are set to public.
I've used a copy of that component that accepts a prop for the post type to check and changes the API endpoint accordingly.
The only way to do this is if multiple endpoints are checked in parallel or a search endpoint is added to the core API. You could add a custom one for that in the meantime to your project.
This will be addressed with #2084