Index: formatting.php
===================================================================
--- formatting.php	(revision 37057)
+++ formatting.php	(working copy)
@@ -2041,6 +2041,30 @@
 }
 
 /**
+ * Navigates through an array, object, or scalar, and adds slashes to the values.
+ *
+ * @since 4.4.3
+ *
+ * @param mixed $value The value to be slashed.
+ * @return mixed Slashed value.
+ */
+function addslashes_deep( $value ) {
+	return map_deep( $value, 'addslashes_to_strings_only' );
+}
+
+/**
+ * Callback function for `addslashes_deep()` which adds slashes to strings.
+ *
+ * @since 4.4.3
+ *
+ * @param mixed $value The array or string to be slashed.
+ * @return mixed $value The slashed value.
+ */
+function addslashes_to_strings_only( $value ) {
+	return is_string( $value ) ? addslashes( $value ) : $value;
+}
+
+/**
  * Navigates through an array, object, or scalar, and encodes the values to be used in a URL.
  *
  * @since 2.2.0
@@ -4394,19 +4418,7 @@
  * @return string|array Slashed $value
  */
 function wp_slash( $value ) {
-	if ( is_array( $value ) ) {
-		foreach ( $value as $k => $v ) {
-			if ( is_array( $v ) ) {
-				$value[$k] = wp_slash( $v );
-			} else {
-				$value[$k] = addslashes( $v );
-			}
-		}
-	} else {
-		$value = addslashes( $value );
-	}
-
-	return $value;
+	return addslashes_deep( $value );
 }
 
 /**
