过滤内容以删除不必要的斜杠。

原型

deslash( string $content )

参数

$content (string) (Required) 要修改的内容。

返回值

(string)  消除了内容。

源文件

路径:wp-admin/includes/upgrade.php

<?php
...
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;
}
...
?>

其他

英文文档:https://developer.wordpress.org/reference/functions/deslash/