Warning: This function has been deprecated.

clean_pre() WordPress Function

The clean_pre() function is used to clean up text before it is displayed in a pre tag. This function is useful for removing extra whitespace or characters that could break the pre tag.

clean_pre( array|string $matches ) #

Accepts matches array from preg_replace_callback in wpautop() or a string.


Description

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


Top ↑

Parameters

$matches

(array|string)(Required)The array or string


Top ↑

Return

(string) The pre block without paragraph/line break conversion.


Top ↑

Source

File: wp-includes/deprecated.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;
}


Top ↑

Changelog

Changelog
VersionDescription
3.4.0This function has been deprecated.
1.2.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More