Title: clean_pre
Published: April 25, 2014
Last modified: April 28, 2025

---

# clean_pre( array|string $matches ): string

## In this article

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

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

This function has been deprecated since 3.4.0.

Accepts matches array from preg_replace_callback in [wpautop()](https://developer.wordpress.org/reference/functions/wpautop/)
or a string.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/clean_pre/?output_format=md#description)󠁿

Ensures that the contents of a `<pre>...</pre>` HTML block are not converted into
paragraphs or line breaks.

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

 `$matches`array|stringrequired

The array or string

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

 string The pre block without paragraph/line break conversion.

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

    ```php
    function clean_pre($matches) {
    	_deprecated_function( __FUNCTION__, '3.4.0' );

    	if ( is_array($matches) )
    		$text = $matches[1] . $matches[2] . "</pre>";
    	else
    		$text = $matches;

    	$text = str_replace(array('<br />', '<br/>', '<br>'), array('', '', ''), $text);
    	$text = str_replace('<p>', "\n", $text);
    	$text = str_replace('</p>', '', $text);

    	return $text;
    }
    ```

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

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

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

Marks a function as deprecated and inform when it has been used.

  |

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

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

## User Contributed Notes

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