Title: _block_template_render_without_post_block_context
Published: July 20, 2021
Last modified: May 20, 2026

---

# _block_template_render_without_post_block_context( array $context ): array

## In this article

 * [Parameters](https://developer.wordpress.org/reference/functions/_block_template_render_without_post_block_context/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/_block_template_render_without_post_block_context/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/_block_template_render_without_post_block_context/?output_format=md#source)
 * [Changelog](https://developer.wordpress.org/reference/functions/_block_template_render_without_post_block_context/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/_block_template_render_without_post_block_context/?output_format=md#wp--skip-link--target)

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

Removes post details from block context when rendering a block template.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/_block_template_render_without_post_block_context/?output_format=md#parameters)󠁿

 `$context`arrayrequired

Default context.

## 󠀁[Return](https://developer.wordpress.org/reference/functions/_block_template_render_without_post_block_context/?output_format=md#return)󠁿

 array Filtered context.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/_block_template_render_without_post_block_context/?output_format=md#source)󠁿

    ```php
    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;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/block-template.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/block-template.php#L437)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/block-template.php#L437-L450)

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/_block_template_render_without_post_block_context/?output_format=md#changelog)󠁿

| Version | Description | 
| [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2F_block_template_render_without_post_block_context%2F)
before being able to contribute a note or feedback.