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



gutenberg_register_legacy_query_loop_block › WordPress Function

Sincen/a
Deprecatedn/a
gutenberg_register_legacy_query_loop_block ( No parameters )
See:
Defined at:
Codex:

Complements the renaming of `Query Loop` to `Post Template`.

This ensures backwards compatibility for any users running the Gutenberg plugin who have used Query Loop prior to its renaming. This can be removed when WordPress 5.9 is released.


Source

function gutenberg_register_legacy_query_loop_block() {
	$registry = WP_Block_Type_Registry::get_instance();
	if ( $registry->is_registered( 'core/query-loop' ) ) {
		unregister_block_type( 'core/query-loop' );
	}
	register_block_type(
		'core/query-loop',
		array(
			'category'          => 'design',
			'uses_context'      => array(
				'queryId',
				'query',
				'queryContext',
				'displayLayout',
				'templateSlug',
			),
			'supports'          => array(
				'reusable' => false,
				'html'     => false,
				'align'    => true,
			),
			'style'             => 'wp-block-post-template',
			'render_callback'   => 'render_legacy_query_loop_block',
			'skip_inner_blocks' => true,
		)
	);
}