I'm trying to display the category/categories from each post within the Latest Posts block in the WordPress editor.

This post seems to provide some solutions, however I am unsure how to use this helpful answer - "wp.data.select('core').getEntityRecords('taxonomy', 'category');"

How would I get a taxonomy/category list inside a Gutenberg block?

A helpful guide would be much appreciated.

  • This is still relevant and needed. I had to create a separate, new block just to have latest posts displayed with category, which is pretty bad and confusing user experience, but I was not able to figure out elegant way to hook into "Post meta settings" of the core "Latest Posts" to add "Display categories" toggle, and to each post in the loop to render categories.
    – Tahi Reu
    Feb 16, 2023 at 6:45


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.