wpseek.com
Outil de recherche WordPress pour les développeurs et auteurs de thèmes



wp_slash › WordPress Function

Depuis3.6.0
Dépréciéen/a
wp_slash ( $value )
Paramètres:
  • (string|array) $value String or array of data to slash.
    Requis: Oui
Retourne:
  • (string|array) Slashed `$value`, in the same type as supplied.
Défini(e) dans:
Codex:
Changelog:
  • 5.5.0

Adds slashes to a string or recursively adds slashes to strings within an array.

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.


Fonctions en relation: wp_unslash, wp_hash, wp_styles, wp_rss, deslash

Source

function wp_slash( $value ) {
	if ( is_array( $value ) ) {
		$value = array_map( 'wp_slash', $value );
	}

	if ( is_string( $value ) ) {
		return addslashes( $value );
	}

	return $value;
}