How to get selected category objects in the block editor?
We need to modified the code with slight different approach. In this modified version of code we are using the useSelect hook to get the selected categories and categories and also ensure the data is available before attempting to filter it. (function (wp) { const { useSelect } = wp.data; function getSelectedCategories() { // We … Read more