Gutenberg Reusable Block of WordPress
Question
I’m using an custom theme and I would like to take the id to the values of a reusable block. I have this code:
<?php
$post = get_post();
if ( has_blocks( $post->post_content ) ) {
$blocks = parse_blocks( get_the_content() );
foreach($blocks as $block) {
$id= isset($block['attrs']['id']) ? $block['attrs']['id'] : '';
echo $id;
}
}
I see the id of all blocks but not reusable blocks. how do I access reusable block data?
0
block-editor
3 years
2019-10-28T03:29:36-05:00
2019-10-28T03:29:36-05:00 0 Answers
60 views
0
Leave an answer