Languages: English • Reference/wp unslash 日本語 (Add your language)
Remove slashes from a string or array of strings.
This should be used to remove slashes from data passed to core API that expects data to be unslashed. Use this instead of stripslashes_deep().
<?php wp_unslash( $value ); ?>
This function can be used in replacement of stripslashes_deep(). As it is a recursive function, when an array is given, it will remove slashes in all sub-arrays too.
$arr = array(
"Is your name O\'reilly?",
"Person\'s Assets"
);
$arr = wp_unslash( $arr );
/*
Outputs:
array(
"Is your name O'reilly?",
"Person's Assets"
);
*/
wp_unslash() is located in wp-includes/formatting.php.
Slashing Functions: wp_slash(), wp_unslash(), stripslashes_deep(), addslashes_gpc(), Escaping Problems with Slashes in WordPress