I have a link control like so:
import { __ } from "@wordpress/i18n";
import {
__experimentalLinkControl as LinkControl,
} from "@wordpress/block-editor";
import "./editor.scss";
export default function ({ attributes, setAttributes }) {
return (
<LinkControl
suggestionQuery={{
type: "post",
subtype: "page",
}}
/>
);
}
However, typing into the search input shows all post types (I want it to just show pages). The documentation says to use it as so:
suggestionsQuery
Type: Object
Required: No
Controls the query
parameters used to search for suggestions. For example, to limit a
query to just Page types use:
<LinkControl
suggestionQuery={ {
type: 'post',
subtype: 'page',
} }
/>
I think I’ve followed that pretty nicely.
The only question in my mind is, the docs also state:
Data sources
By default LinkControl utilizes the
__experimentalFetchLinkSuggestions
API fromcore/block-editor
in order to retrieve search suggestions for matching post-type entities.By default this provides no functionality and so you must implement and provide this in your own Editor instance (example).
I cannot wrap my head around. It also may not be why my code isn’t working. Would anyone be able to show how I can make this work?