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



block_core_gallery_render_context › WordPress Function

Since7.0.0
Deprecatedn/a
block_core_gallery_render_context ( $context, $parsed_block )
Parameters: (2)
  • (array) $context Default context.
    Required: Yes
  • (array) $parsed_block Block being rendered, filtered by render_block_data.
    Required: Yes
Returns:
  • (array) Filtered context.
Defined at:
Codex:

Adds a unique ID to the gallery block context.



Source

function block_core_gallery_render_context( $context, $parsed_block ) {
	if ( 'core/gallery' === $parsed_block['blockName'] ) {
		$context['galleryId'] = uniqid();
	}
	return $context;
}