wpseek.com
A WordPress-centric search engine for devs and theme authors



convert_chars › WordPress Function

Since0.71
Deprecatedn/a
convert_chars ( $content, $deprecated = '' )
Parameters: (2)
  • (string) $content String of characters to be converted.
    Required: Yes
  • (string) $deprecated Not used.
    Required: No
    Default: (empty)
Returns:
  • (string) Converted string.
Defined at:
Codex:

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



Source

function convert_chars( $content, $deprecated = '' ) {
	if ( ! empty( $deprecated ) ) {
		_deprecated_argument( __FUNCTION__, '0.71' );
	}

	if ( str_contains( $content, '&' ) ) {
		$content = preg_replace( '/&([^#])(?![a-z1-4]{1,8};)/i', '&$1', $content );
	}

	return $content;
}