block_core_navigation_get_post_ids()
Iterate through all inner blocks recursively and get navigation link block's post IDs.
No Hooks.
Returns
Array. Array of post IDs.
Usage
block_core_navigation_get_post_ids( $inner_blocks );
- $inner_blocks(WP_Block_List) (required)
- Block list class instance.
Changelog
| Since 6.0.0 | Introduced. |
block_core_navigation_get_post_ids() block core navigation get post ids code WP 6.9
function block_core_navigation_get_post_ids( $inner_blocks ) {
$post_ids = array_map( 'block_core_navigation_from_block_get_post_ids', iterator_to_array( $inner_blocks ) );
return array_unique( array_merge( ...$post_ids ) );
}