sanitize_key

Definition:
function sanitize_key( $key ) {}

Sanitize a string key.
Keys are used as internal identifiers. Lowercase alphanumeric characters, dashes and underscores are allowed.

Parameters

  • string $key: String key

Return values

returns:Sanitized key

Defined filters

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

Source code

function sanitize_key( $key ) {

	$raw_key = $key;

	$key = strtolower( $key );

	$key = preg_replace( '/[^a-z0-9_\-]/', '', $key );

	return apply_filters( 'sanitize_key', $key, $raw_key );

}

2775

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: