Title: wp_slash_strings_only
Published: November 12, 2019
Last modified: April 28, 2025

---

# wp_slash_strings_only( mixed $value ): mixed

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/wp_slash_strings_only/?output_format=md#description)
    - [See also](https://developer.wordpress.org/reference/functions/wp_slash_strings_only/?output_format=md#see-also)
 * [Parameters](https://developer.wordpress.org/reference/functions/wp_slash_strings_only/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/wp_slash_strings_only/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/wp_slash_strings_only/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/wp_slash_strings_only/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/wp_slash_strings_only/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/wp_slash_strings_only/?output_format=md#wp--skip-link--target)

This function has been deprecated since 5.6.0. Use [wp_slash()](https://developer.wordpress.org/reference/functions/wp_slash/)
instead.

Adds slashes to only string values in an array of values.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/wp_slash_strings_only/?output_format=md#description)󠁿

This should be used when preparing data for core APIs that expect slashed data.

This should not be used to escape data going directly into an SQL query.

### 󠀁[See also](https://developer.wordpress.org/reference/functions/wp_slash_strings_only/?output_format=md#see-also)󠁿

 * [wp_slash()](https://developer.wordpress.org/reference/functions/wp_slash/)

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

 `$value`mixedrequired

Scalar or array of scalars.

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

 mixed Slashes $value

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

    ```php
    function wp_slash_strings_only( $value ) {
    	return map_deep( $value, 'addslashes_strings_only' );
    }
    ```

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

## 󠀁[Related](https://developer.wordpress.org/reference/functions/wp_slash_strings_only/?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.

  |

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

| Version | Description | 
| [5.6.0](https://developer.wordpress.org/reference/since/5.6.0/) | Deprecated. Use [wp_slash()](https://developer.wordpress.org/reference/functions/wp_slash/)  | 
| [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Introduced. |

## User Contributed Notes

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