wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



block_core_navigation_from_block_get_post_ids › WordPress Function

Seitn/v
Veraltetn/v
block_core_navigation_from_block_get_post_ids ( $block )
Parameter:
  • (WP_Block) $block Instance of a block.
    Erforderlich: Ja
Gibt zurück:
  • (array) Array of post IDs.
Definiert in:
Codex:

Get post IDs from a navigation link block instance.



Quellcode

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'] ) {
			$post_ids[] = $block->attributes['id'];
		}
	}

	return $post_ids;
}