get_dynamic_block_names() WordPress Function

The get_dynamic_block_names() function is used to retrieve the names of all dynamic blocks registered in the current WordPress installation.

get_dynamic_block_names() #

Returns an array of the names of all registered dynamic block types.


Return

(string[]) Array of dynamic block names.


Top ↑

Source

File: wp-includes/blocks.php

function get_dynamic_block_names() {
	$dynamic_block_names = array();

	$block_types = WP_Block_Type_Registry::get_instance()->get_all_registered();
	foreach ( $block_types as $block_type ) {
		if ( $block_type->is_dynamic() ) {
			$dynamic_block_names[] = $block_type->name;
		}
	}

	return $dynamic_block_names;
}


Top ↑

Changelog

Changelog
VersionDescription
5.0.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.