import { useSelect } from '@wordpress/data'; const useCurrentPostCategories = () => { const categoryIds = wp.data.select('core/editor').getEditedPostAttribute('categories') return useSelect((select) => { const {getEntityRecords} = select('core') const taxonomies = getEntityRecords('taxonomy', 'category') if (!taxonomies) return [] const currentCategories = taxonomies.filter(taxonomy => { return ca