wppaste
WordPress

_block_template_render_without_post_block_context( array $context ): array

Since
5.8.0
Source
wp-includes/block-template.php:437
Removes post details from block context when rendering a block template.

Parameters

$contextarray
Default context.

Return

array
Filtered context.

Source

function _block_template_render_without_post_block_context( $context ) {	/*	 * When loading a template directly and not through a page that resolves it,	 * the top-level post ID and type context get set to that of the template.	 * Templates are just the structure of a site, and they should not be available	 * as post context because blocks like Post Content would recurse infinitely.	 */	if ( isset( $context['postType'] ) && 'wp_template' === $context['postType'] ) {		unset( $context['postId'] );		unset( $context['postType'] );	} 	return $context;}

History

Introduced in 5.8.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 7.1.0 tag, from src/wp-includes/block-template.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.