_block_template_render_without_post_block_context
函数
_block_template_render_without_post_block_context ( $context )
- Access
- Private
- 参数
-
-
(array)
$context
Default context.- Required: 是
-
(array)
- 返回值
-
- (array) Filtered context.
- 定义位置
-
-
wp-includes/block-template.php
, line 288
-
wp-includes/block-template.php
- 引入
- 5.8.0
- 弃用
- –
Removes post details from block context when rendering a block template.
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; }
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。