Index: src/wp-includes/formatting.php
===================================================================
--- src/wp-includes/formatting.php	(revision 26238)
+++ src/wp-includes/formatting.php	(working copy)
@@ -3404,7 +3404,7 @@
 }
 
 /**
- * Add slashes to a string or array of strings.
+ * Add slashes to a string or array of strings, in recursive manner.
  *
  * This should be used when preparing data for core API that expects slashed data.
  * This should not be used to escape data going directly into an SQL query.
@@ -3416,13 +3416,7 @@
  */
 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 );
-			}
-		}
+		$value = array_map( 'wp_slash', $value );
 	} else {
 		$value = addslashes( $value );
 	}
Index: tests/phpunit/tests/formatting/StripSlashesDeep.php
===================================================================
--- tests/phpunit/tests/formatting/StripSlashesDeep.php	(revision 26238)
+++ tests/phpunit/tests/formatting/StripSlashesDeep.php	(working copy)
@@ -2,6 +2,7 @@
 
 /**
  * @group formatting
+ * @group slashes
  */
 class Tests_Formatting_StripSlashesDeep extends WP_UnitTestCase {
 	/**
Index: tests/phpunit/tests/formatting/WPSlash.php
===================================================================
--- tests/phpunit/tests/formatting/WPSlash.php	(revision 0)
+++ tests/phpunit/tests/formatting/WPSlash.php	(working copy)
@@ -0,0 +1,21 @@
+<?php
+
+/**
+ * @group formatting
+ * @group slashes
+ */
+class Tests_Formatting_WPSlash extends WP_UnitTestCase {
+
+	/**
+	 * @ticket 24106
+	 */
+	function test_adds_slashes() {
+		$old = "I can't see, isn't that it?";
+		$new = "I can\'t see, isn\'t that it?";
+		$this->assertEquals( $new, wp_slash( $old ) );
+		$this->assertEquals( "I can\\\\\'t see, isn\\\\\'t that it?", wp_slash( $new ) );
+		$this->assertEquals( array( 'a' => $new ), wp_slash( array( 'a' => $old ) ) ); // Keyed array
+		$this->assertEquals( array( $new ), wp_slash( array( $old ) ) ); // Non-keyed
+	}
+
+}
