wpseek.com
WordPress开发者和主题制作者的搜索引擎
_block_template_render_without_post_block_context is private and should not be used in themes or plugins directly.
_block_template_render_without_post_block_context › WordPress Function
Since5.8.0
已弃用n/a
› _block_template_render_without_post_block_context ( $context )
访问: |
|
参数: |
|
返回: |
|
定义在: |
|
文档: |
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; }