Title: _restore_wpautop_hook
Published: December 6, 2018
Last modified: February 24, 2026

---

# _restore_wpautop_hook( string $content ): string

## In this article

 * [Parameters](https://developer.wordpress.org/reference/functions/_restore_wpautop_hook/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/_restore_wpautop_hook/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/_restore_wpautop_hook/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/_restore_wpautop_hook/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/_restore_wpautop_hook/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/_restore_wpautop_hook/?output_format=md#wp--skip-link--target)

This function’s access is marked private. This means it is not intended for use 
by plugin or theme developers, only by core. It is listed here for completeness.

If [do_blocks()](https://developer.wordpress.org/reference/functions/do_blocks/)
needs to remove [wpautop()](https://developer.wordpress.org/reference/functions/wpautop/)
from the `the_content` filter, this re-adds it afterwards, for subsequent `the_content`
usage.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/_restore_wpautop_hook/?output_format=md#parameters)󠁿

 `$content`stringrequired

The post content running through this filter.

## 󠀁[Return](https://developer.wordpress.org/reference/functions/_restore_wpautop_hook/?output_format=md#return)󠁿

 string The unmodified content.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/_restore_wpautop_hook/?output_format=md#source)󠁿

    ```php
    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;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/blocks.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/blocks.php#L2490)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/blocks.php#L2490-L2497)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/_restore_wpautop_hook/?output_format=md#related)󠁿

| Uses | Description | 
| [has_filter()](https://developer.wordpress.org/reference/functions/has_filter/)`wp-includes/plugin.php` |

Checks if any filter has been registered for a hook.

  | 
| [add_filter()](https://developer.wordpress.org/reference/functions/add_filter/)`wp-includes/plugin.php` |

Adds a callback function to a filter hook.

  | 
| [remove_filter()](https://developer.wordpress.org/reference/functions/remove_filter/)`wp-includes/plugin.php` |

Removes a callback function from a filter hook.

  |

[Show 1 more](https://developer.wordpress.org/reference/functions/_restore_wpautop_hook/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/_restore_wpautop_hook/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/_restore_wpautop_hook/?output_format=md#changelog)󠁿

| Version | Description | 
| [5.0.0](https://developer.wordpress.org/reference/since/5.0.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2F_restore_wpautop_hook%2F)
before being able to contribute a note or feedback.