How to get an array of custom blocks by block name

Question

Scenario: I have created a custom block that outputs a list of posts, with control over number of posts, and the taxonomies where the posts can be selected from.

The custom block is nested inside a custom “row” block, and further inside a core “column” block. The registered id of the custom block is e.g. ‘xx/dyno-list’

Need: I need to extract a list of the posts that have been assigned to the custom block via grabbing the data attached to each block, e.g. an array of posts.

Perhaps using something like:
wp.data.select('core/blocks').getBlockTypes('xx/dyno-list')
which does not work…

Each custom block has a unique “name” attribute, e.g. “block_one”, so I need to be able to grab the list of custom blocks, i.e. ‘xx/dyno-list’ and then grab the lists of posts within that specific block.

I need this so as to be able to “de-dupe” the posts list between custom post list blocks.

Question: How to grab a list of the custom blocks by their registered name and then by the attribute name

0
Digitalle 4 years 2019-10-22T12:02:15-05:00 0 Answers 78 views 0

Leave an answer

Browse
Browse