wp_unslash( string|array $value )

Remove slashes from a string or array of strings.


Description Description

This should be used to remove slashes from data passed to core API that expects data to be unslashed.


Parameters Parameters

$value

(string|array) (Required) String or array of strings to unslash.


Top ↑

Return Return

(string|array) Unslashed $value


Top ↑

Source Source

File: wp-includes/formatting.php

function wp_unslash( $value ) {
	return stripslashes_deep( $value );
}

Top ↑

Changelog Changelog

Changelog
Version Description
3.6.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

  1. Skip to note 1 content
    Contributed by Codex

    Example

    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"
     );
    */
    

You must log in before being able to contribute a note or feedback.