WordPress开发者和主题制作者的搜索引擎



_restore_wpautop_hook ›

Since5.0.0
已弃用n/a
_restore_wpautop_hook ( $content )
访问:
  • private
参数:
  • (string) $content The post content running through this filter.
    Required: Yes
返回:
  • (string) The unmodified content.
定义在:
文档:

If do_blocks() needs to remove wpautop() from the `the_content` filter, this re-adds it afterwards, for subsequent `the_content` usage.



源码

function _restore_wpautop_hook( $content ) {
	$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;
}