Title: stripslashes_deep
Published: April 25, 2014
Last modified: August 20, 2026

---

# stripslashes_deep( mixed $value ): mixed

## In this article

 * [Parameters](https://developer.wordpress.org/reference/functions/stripslashes_deep/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/stripslashes_deep/?output_format=md#return)
 * [More Information](https://developer.wordpress.org/reference/functions/stripslashes_deep/?output_format=md#more-information)
 * [Source](https://developer.wordpress.org/reference/functions/stripslashes_deep/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/stripslashes_deep/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/stripslashes_deep/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/functions/stripslashes_deep/?output_format=md#user-contributed-notes)

Navigates through an array, object, or scalar, and removes slashes from the values.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/stripslashes_deep/?output_format=md#parameters)󠁿

 `$value`mixedrequired

The value to be stripped.

## 󠀁[Return](https://developer.wordpress.org/reference/functions/stripslashes_deep/?output_format=md#return)󠁿

 mixed Stripped value.

## 󠀁[More Information](https://developer.wordpress.org/reference/functions/stripslashes_deep/?output_format=md#more-information)󠁿

If an array is passed, the [array_map()](http://www.php.net/manual/en/function.array-map.php)
function causes a callback to pass the value back to the function. The slashes from
each value will be removed using the [stripslashes()](http://www.php.net/manual/en/function.stripslashes.php)
function.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/stripslashes_deep/?output_format=md#source)󠁿

    ```php
    function stripslashes_deep( $value ) {
    	return map_deep( $value, 'stripslashes_from_strings_only' );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/formatting.php#L2860)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/formatting.php#L2860-L2862)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/stripslashes_deep/?output_format=md#related)󠁿

| Uses | Description | 
| [map_deep()](https://developer.wordpress.org/reference/functions/map_deep/)`wp-includes/formatting.php` |

Maps a function to all non-iterable elements of an array or an object.

  |

| Used by | Description | 
| [wp_ajax_send_attachment_to_editor()](https://developer.wordpress.org/reference/functions/wp_ajax_send_attachment_to_editor/)`wp-admin/includes/ajax-actions.php` |

Handles sending an attachment to the editor via AJAX.

  | 
| [wp_unslash()](https://developer.wordpress.org/reference/functions/wp_unslash/)`wp-includes/formatting.php` |

Removes slashes from a string or recursively removes slashes from strings within an array.

  | 
| [WP_Widget::update_callback()](https://developer.wordpress.org/reference/classes/wp_widget/update_callback/)`wp-includes/class-wp-widget.php` |

Handles changed settings (Do NOT override).

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/stripslashes_deep/?output_format=md#changelog)󠁿

| Version | Description | 
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/functions/stripslashes_deep/?output_format=md#user-contributed-notes)󠁿

 1.   [Skip to note 3 content](https://developer.wordpress.org/reference/functions/stripslashes_deep/?output_format=md#comment-content-1045)
 2.    [Codex](https://profiles.wordpress.org/codex/)  [  11 years ago  ](https://developer.wordpress.org/reference/functions/stripslashes_deep/#comment-1045)
 3.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fstripslashes_deep%2F%23comment-1045)
     Vote results for this note: 4[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fstripslashes_deep%2F%23comment-1045)
 4.  **Good Coding Practice**
      WordPress adds slashes to $_POST/$_GET/$_REQUEST/$_COOKIE
     regardless of what get_magic_quotes_gpc() returns. So in the context of WordPress,
     stripslashes() or stipslashes_deep() should always be used when using those variables.
 5.  Example:
 6.      ```php
         $my_post = stripslashes_deep($_POST);
         $my_value = $my_post['value'];
         ```
     
 7.  Or:
 8.      ```php
         $my_value = stripslashes($_POST['value']);
         ```
     
 9.   [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fstripslashes_deep%2F%3Freplytocom%3D1045%23feedback-editor-1045)
 10.  [Skip to note 4 content](https://developer.wordpress.org/reference/functions/stripslashes_deep/?output_format=md#comment-content-1044)
 11.   [Codex](https://profiles.wordpress.org/codex/)  [  11 years ago  ](https://developer.wordpress.org/reference/functions/stripslashes_deep/#comment-1044)
 12. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fstripslashes_deep%2F%23comment-1044)
     Vote results for this note: 1[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fstripslashes_deep%2F%23comment-1044)
 13. **Basic Example**
      You may want this function when developing your own PHP application
     intended to run within the WordPress environment. Specifically, your program needs
     to strip slashes when data arrives via $_POST, $_GET, $_COOKIE, and $_REQUEST 
     arrays.
 14. An example would be a “Contact Me” page and the ancillary program that sanitizes
     the user-supplied text. Such user inputs typically travel from an HTML to your
     program by way of the $_POST array. [stripslashes_deep()](https://developer.wordpress.org/reference/functions/stripslashes_deep/),
     in that case, could be used thus (caution, see notes below):
 15.     ```php
         $_POST = stripslashes_deep( $_POST );
         ```
     
 16. The [stripslashes_deep()](https://developer.wordpress.org/reference/functions/stripslashes_deep/)
     function is recursive and will walk through the $_POST array even when some of
     the elements are themselves an array.
 17. Please note: WordPress Core and most plugins will still be expecting slashes, 
     and the above code will confuse and break them. If you must unslash, consider 
     only doing it to your own data which isn’t used by others:
 18.     ```php
         $your_own_data = stripslashes_deep( $_POST['your_own_data'] );
         ```
     
 19.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fstripslashes_deep%2F%3Freplytocom%3D1044%23feedback-editor-1044)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fstripslashes_deep%2F)
before being able to contribute a note or feedback.