_restore_wpautop_hook

The timeline below displays how wordpress function _restore_wpautop_hook has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.1

/**
 * If do_blocks() needs to remove wpautop() from the `the_content` filter, this re-adds it afterwards,
 * for subsequent `the_content` usage.
 *
 * @since 5.0.0
 * @access private
 *
 * @param string $content The post content running through this filter.
 * @return string The unmodified content.
 */
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;
}

WordPress Version: 5.2

/**
 * If do_blocks() needs to remove wpautop() from the `the_content` filter, this re-adds it afterwards,
 * for subsequent `the_content` usage.
 *
 * @access private
 *
 * @since 5.0.0
 *
 * @param string $content The post content running through this filter.
 * @return string The unmodified content.
 */
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;
}

WordPress Version: 5.1

/**
 * If do_blocks() needs to remove wp_autop() from the `the_content` filter, this re-adds it afterwards,
 * for subsequent `the_content` usage.
 *
 * @access private
 *
 * @since 5.0.0
 *
 * @param string $content The post content running through this filter.
 * @return string The unmodified content.
 */
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;
}

WordPress Version: 5.0

/**
 * If do_blocks() needs to remove wp_autop() from the `the_content` filter, this re-adds it afterwards,
 * for subsequent `the_content` usage.
 *
 * @access private
 *
 * @since 5.0.0
 *
 * @param string $content The post content running through this filter.
 * @return string The unmodified content.
 */
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;
}