WPIntell

Source evidence

Schema JSON not working

FAQ Block For Gutenberg · support · 2024-09-12T19:12:00+00:00

mixedsentiment
mediumseverity
0.84relevance
3replies
Evidence linked to opportunitycommercial context

Proof Health

Open evidence

Commercial opportunities need traceable source links before they are treated as build-worthy.

3 / 26 rows with source links

11.5% of this page's analysis has direct source links.

0 build-decision rows missing links

0 rows here require auditable proof before promotion.

23 rows with no attached evidence

0 rows have source counts but still need direct links.

Conversation

support
tomrobertsuk resolved
Hi Dilip, I’ve installed the plugin and added some FAQs, but I’m not seeing any JSON on the page. Is the plugin compatible with a full site editing theme? Thanks @tomrobertsuk I’ve checked with the FSE editor and it seems working fine, You can check with https://playground.wordpress.net/ Thanks Hi, \Faq_Block_For_Gutenberg::gutenberg_faq_block_parse_blocks uses parse_blocks() function, which returns an array of first-level blocks. The fact is that each block may contain nested block(s) where FAQ may reside. So, to parse the entire post content, I think you need to make this function recursive. Something like that: private function gutenberg_faq_block_parse_blocks($blocks = null) { global $post; $block_data = array(); if( empty($blocks) && $post ){ $blocks = isset( $post->post_content ) ? parse_blocks( $post->post_content ) : array(); } if( !empty($blocks) ){ foreach( $blocks as $block ){ if( 'faq-block-for-gutenberg/faq' === $block['blockName'] ){ $block_data[] = $block; continue; } // Search in nested blocks if( !empty($block['innerBlocks']) ) { $block_data = array_merge( $block_data, $this->gutenberg_faq_block_parse_blocks($block['innerBlocks']) ); } } } return $block_data; } @cyrilbatillat Thank you! I’ve resolved the schema JSON issue with nested blocks. Please check with the latest plugin release (v2.7) and let me know if you encounter any issues. I’m going to mark this ticket as resolved. Feel free to open a new support ticket if you have any issues or suggestions. cc @tomrobertsuk Thanks!

Comments

3 shown
Dilip Bheda 2024-09-20T07:35:00+00:00

@tomrobertsuk I’ve checked with the FSE editor and it seems working fine, You can check with https://playground.wordpress.net/ Thanks

Cyril Batillat 2025-02-21T17:25:00+00:00

Hi, \Faq_Block_For_Gutenberg::gutenberg_faq_block_parse_blocks uses parse_blocks() function, which returns an array of first-level blocks. The fact is that each block may contain nested block(s) where FAQ may reside. So, to parse the entire post content, I think you need to make this function recursive. Something like that: private function gutenberg_faq_block_parse_blocks($blocks = null) { global $post; $block_data = array(); if( empty($blocks) && $post ){ $blocks = isset( $post->post_content ) ? parse_blocks( $post->post_content ) : array(); } if( !empty($blocks) ){ foreach( $blocks as $block ){ if( 'faq-block-for-gutenberg/faq' === $block['blockName'] ){ $block_data[] = $block; continue; } // Search in nested blocks if( !empty($block['innerBlocks']) ) { $block_data = array_merge( $block_data, $this->gutenberg_faq_block_parse_blocks($block['innerBlocks']) ); } } } return $block_data; }

Dilip Bheda 2025-02-22T09:15:00+00:00

@cyrilbatillat Thank you! I’ve resolved the schema JSON issue with nested blocks. Please check with the latest plugin release (v2.7) and let me know if you encounter any issues. I’m going to mark this ticket as resolved. Feel free to open a new support ticket if you have any issues or suggestions. cc @tomrobertsuk Thanks!