如果do_blocks()需要从the_content过滤器中删除wp_autop(),则会在之后重新添加它,以用于后续的the_content使用。
原型
_restore_wpautop_hook( string $content )
参数
$content
(string)
(Required)
通过此过滤器运行的帖子内容。
返回值
(string)
未经修改的内容。
源文件
路径:wp-includes/blocks.php
<?php
...
function _restore_wpautop_hook( $content ) {
global $wp_filter;
$current_priority = has_filter( 'the_content', '_restore_wpautop_hook' );
add_filter( 'the_content', 'wpautop', $current_priority - 1 );
remove_filter( 'the_content', '_restore_wpautop_hook', $current_priority );
return $content;
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/_restore_wpautop_hook/