sanitize_key WordPress Filter Hook

The sanitize_key wordpress hook is used to sanitize a string key. This is useful for ensuring that a string key is properly formatted for use in a wordpress database.

apply_filters( 'sanitize_key', string $sanitized_key, string $key ) #

Filters a sanitized key string.


Parameters

$sanitized_key

(string)Sanitized key.

$key

(string)The key prior to sanitization.


Top ↑

More Information

  • By default, sanitize_key() function sanitize a string key, which is used as internal identifiers, into lowercase alphanumeric, dashes, and underscores characters. After sanitize_key() function has done its work, it passes the sanitized key through this sanitize_key filter.
  • The filter passes $key and $raw_key as parameters, which allows the user of this filter to perform additional sanitization based on these two keys.

Top ↑

Source

File: wp-includes/formatting.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
3.0.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More