Codex

Function Reference/sanitize key

Contents

Description

Sanitize a string key.

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

Usage

<?php sanitize_key$key ); ?>

Parameters

$key
(string) (required) String key
Default: None

Return Values

(string) 
Sanitized key

Examples

Notes

Filters

  • 'sanitize_key':
    apply_filters( 'sanitize_key', $key, $raw_key )

Change Log

Since: 3.0.0

Source File

sanitize_key() is located in /wp-includes/formatting.php.

Related Functions

sanitize_key() is in a class of functions that help you sanitize potentially unsafe data which allow you to pass an arbitrary variable and receive the clean version based on data type. Others include:

Related