WP_Block_Supports::register_attributes()

In this article

This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

Registers the block attributes required by the different block supports.

Source

private function register_attributes() {
	$block_registry         = WP_Block_Type_Registry::get_instance();
	$registered_block_types = $block_registry->get_all_registered();
	foreach ( $registered_block_types as $block_type ) {
		if ( ! ( $block_type instanceof WP_Block_Type ) ) {
			continue;
		}
		if ( ! $block_type->attributes ) {
			$block_type->attributes = array();
		}

		foreach ( $this->block_supports as $block_support_config ) {
			if ( ! isset( $block_support_config['register_attribute'] ) ) {
				continue;
			}

			call_user_func(
				$block_support_config['register_attribute'],
				$block_type
			);
		}
	}
}

Changelog

VersionDescription
5.6.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.