Un motore di ricerca WordPress per sviluppatori e autori di temi



sanitize_key ›

Da3.0.0
Deprecaton/a
sanitize_key ( $key )
Parametri:
  • (string) $key String key
    Richiesto:
Ritorna:
  • (string) Sanitized key
Definito a:
Codex:

Sanitizes a string key.

Keys are used as internal identifiers. Lowercase alphanumeric characters, dashes and underscores are allowed.



Sorgenti

function sanitize_key( $key ) {
	$raw_key = $key;
	$key     = strtolower( $key );
	$key     = preg_replace( '/[^a-z0-9_\-]/', '', $key );

	/**
	 * Filters a sanitized key string.
	 *
	 * @since 3.0.0
	 *
	 * @param string $key     Sanitized key.
	 * @param string $raw_key The key prior to sanitization.
	 */
	return apply_filters( 'sanitize_key', $key, $raw_key );
}