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



deslash › WordPress Function

Since1.5.0
Deprecatedn/a
deslash ( $content )
Parameters:
  • (string) $content The content to modify.
    Required: Yes
Returns:
  • (string) The de-slashed content.
Defined at:
Codex:

Filters for content to remove unnecessary slashes.



Source

function deslash( $content ) {
	// Note: \\\ inside a regex denotes a single backslash.

	/*
	 * Replace one or more backslashes followed by a single quote with
	 * a single quote.
	 */
	$content = preg_replace( "/\\\+'/", "'", $content );

	/*
	 * Replace one or more backslashes followed by a double quote with
	 * a double quote.
	 */
	$content = preg_replace( '/\\\+"/', '"', $content );

	// Replace one or more backslashes with one backslash.
	$content = preg_replace( '/\\\+/', '\\', $content );

	return $content;
}