wpseek.com
A WordPress-centric search engine for devs and theme authors



block_core_navigation_from_block_get_post_ids › WordPress Function

Since6.0.0
Deprecatedn/a
block_core_navigation_from_block_get_post_ids ( $block )
Parameters:
  • (WP_Block) $block Instance of a block.
    Required: Yes
Returns:
  • (array) Array of post IDs.
Defined at:
Codex:

Get post IDs from a navigation link block instance.



Source

function block_core_navigation_from_block_get_post_ids( $block ) {
	$post_ids = array();

	if ( $block->inner_blocks ) {
		$post_ids = block_core_navigation_get_post_ids( $block->inner_blocks );
	}

	if ( 'core/navigation-link' === $block->name || 'core/navigation-submenu' === $block->name ) {
		if ( $block->attributes && isset( $block->attributes['kind'] ) && 'post-type' === $block->attributes['kind'] && isset( $block->attributes['id'] ) ) {
			$post_ids[] = $block->attributes['id'];
		}
	}

	return $post_ids;
}