I would like to have a multi select field for my categories. How can i do that?
My code doesn't work:
function getCategories () {
var options = [];
var categories = wp.data.select('core').getEntityRecords('taxonomy', 'category');
categories.forEach((category) => {
options.push({ value: category.id, label: category.name });
});
}
<SelectControl
multiple
label={__('Select a Post')}
help={__('Select a post to display as a banner.')}
options={getCategories}
/>
SelectControl
, and the component references choosing posts not categories. Use the edit link under the tags to answer as many of those questions as possible. How are you intending to save the values?