W3cubDocs

/WordPress

WP_Block_Patterns_Registry::get_all_registered( bool $outside_init_only = false ): array[]

Retrieves all registered block patterns.

Parameters

$outside_init_onlybooloptional
Return only patterns registered outside the init action.

Default:false

Return

array[] Array of arrays containing the registered block patterns properties, and per style.

Source

public function get_all_registered( $outside_init_only = false ) {
	$patterns      = $outside_init_only
			? $this->registered_patterns_outside_init
			: $this->registered_patterns;
	$hooked_blocks = get_hooked_blocks();

	foreach ( $patterns as $index => $pattern ) {
		$content                       = $this->get_content( $pattern['name'], $outside_init_only );
		$patterns[ $index ]['content'] = apply_block_hooks_to_content(
			$content,
			$pattern,
			'insert_hooked_blocks_and_set_ignored_hooked_blocks_metadata'
		);
	}

	return array_values( $patterns );
}

Changelog

Version Description
5.5.0 Introduced.

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_block_patterns_registry/get_all_registered