clean_pre

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

Description

(string) clean_pre( (array|string) $matches ); 

Ensures that the contents of a '' HTML block are not converted into paragraphs or line-breaks.

Returns (string)

The pre block without paragraph/line-break conversion.

Parameters (1)

0. $matches (array|string)
The array or string

Usage

  1. if ( !function_exists( 'clean_pre' ) ) { 
  2. require_once ABSPATH . WPINC . '/deprecated.php'; 
  3.  
  4. // The array or string 
  5. $matches = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = clean_pre($matches); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/deprecated.php  
  1. function clean_pre($matches) { 
  2. _deprecated_function( __FUNCTION__, '3.4.0' ); 
  3.  
  4. if ( is_array($matches) ) 
  5. $text = $matches[1] . $matches[2] . "</pre>"; 
  6. else 
  7. $text = $matches; 
  8.  
  9. $text = str_replace(array('<br />', '<br/>', '<br>'), array('', '', ''), $text); 
  10. $text = str_replace('<p>', "\n", $text); 
  11. $text = str_replace('</p>', '', $text); 
  12.  
  13. return $text;