convert_chars

Converts lone & characters into `&` (a.k.a.

Description

(string) convert_chars( (string) $content, (string) $deprecated = '' ); 

'&')

Returns (string)

Converted string.

Parameters (2)

0. $content (string)
String of characters to be converted.
1. $deprecated — Optional. (string) => ''
The deprecated.

Usage

  1. if ( !function_exists( 'convert_chars' ) ) { 
  2. require_once ABSPATH . WPINC . '/formatting.php'; 
  3.  
  4. // String of characters to be converted. 
  5. $content = ''; 
  6.  
  7. // The deprecated. 
  8. $deprecated = ''; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = convert_chars($content, $deprecated); 
  12.  

Defined (1)

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

/wp-includes/formatting.php  
  1. function convert_chars( $content, $deprecated = '' ) { 
  2. if ( ! empty( $deprecated ) ) { 
  3. _deprecated_argument( __FUNCTION__, '0.71' ); 
  4.  
  5. if ( strpos( $content, '&' ) !== false ) { 
  6. $content = preg_replace( '/&([^#])(?![a-z1-4]{1, 8};)/i', '&$1', $content ); 
  7.  
  8. return $content;