sanitize_key( string $key )
Sanitizes a string key.
Description
Keys are used as internal identifiers. Lowercase alphanumeric characters, dashes and underscores are allowed.
Parameters
- $key
-
(Required) String key
Return
(string) Sanitized key
Source
File: wp-includes/formatting.php
function sanitize_key( $key ) {
$raw_key = $key;
$key = strtolower( $key );
$key = preg_replace( '/[^a-z0-9_\-]/', '', $key );
/**
* Filters a sanitized key string.
*
* @since WP-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 );
}
Related
Uses
Uses | Description |
---|---|
wp-includes/plugin.php: apply_filters() |
Call the functions added to a filter hook. |
wp-includes/formatting.php: sanitize_key |
Filters a sanitized key string. |
Used By
Used By | Description |
---|---|
wp-includes/customize/class-wp-customize-nav-menu-item-setting.php: WP_Customize_Nav_Menu_Item_Setting::sanitize() |
Sanitize an input. |
wp-includes/class-wp-user-query.php: WP_User_Query::prepare_query() |
Prepare the query variables. |
wp-includes/class-wp-query.php: WP_Query::parse_query() |
Parse a query string and set query type booleans. |
wp-includes/class-wp-query.php: WP_Query::parse_orderby() |
Converts the given orderby alias (if allowed) to a properly-prefixed value. |
wp-includes/class-wp-tax-query.php: WP_Tax_Query::transform_query() |
Transforms a single query, from one field to another. |
wp-includes/nav-menu.php: wp_update_nav_menu_item() |
Save the properties of a menu item or create a new one. |
wp-includes/class-wp-meta-query.php: WP_Meta_Query::get_sql() |
Generates SQL clauses to be appended to a main query. |
wp-includes/post-formats.php: has_post_format() |
Check if a post has any of the given formats, or any format. |
wp-includes/post-formats.php: set_post_format() |
Assign a format to a post |
wp-includes/meta.php: update_metadata_by_mid() |
Update meta data by meta ID |
wp-includes/meta.php: delete_metadata_by_mid() |
Delete meta data by meta ID |
wp-includes/meta.php: update_meta_cache() |
Update the metadata cache for the specified objects. |
wp-includes/meta.php: add_metadata() |
Add metadata for the specified object. |
wp-includes/meta.php: update_metadata() |
Update metadata for the specified object. If no value already exists for the specified object ID and metadata key, the metadata will be added. |
wp-includes/meta.php: delete_metadata() |
Delete metadata for the specified object. |
wp-includes/user.php: wp_create_user_request() |
Create and log a user request to perform a specific action. |
wp-includes/class-wp-theme.php: WP_Theme::get_post_templates() |
Returns the theme’s post templates. |
wp-includes/theme.php: _wp_customize_include() |
Includes and instantiates the WP_Customize_Manager class. |
wp-includes/class-wp-xmlrpc-server.php: wp_xmlrpc_server::mw_newPost() |
Create a new post. |
wp-includes/class-wp-xmlrpc-server.php: wp_xmlrpc_server::mw_editPost() |
Edit a post. |
wp-includes/class-wp-customize-manager.php: WP_Customize_Manager::handle_load_themes_request() |
Load themes into the theme browsing/installation UI. |
wp-includes/class-wp-customize-manager.php: WP_Customize_Manager::__construct() |
Constructor. |
wp-includes/post.php: _get_last_post_time() |
Get the timestamp of the last time any post was modified or published. |
wp-includes/post.php: register_post_type() |
Registers a post type. |
wp-includes/post.php: register_post_status() |
Register a post status. Do not use before init. |
wp-includes/class-wp-customize-nav-menus.php: WP_Customize_Nav_Menus::ajax_load_available_items() |
Ajax handler for loading available menu items. |
wp-includes/load.php: wp_start_scraping_edited_file_errors() |
Start scraping edited file errors. |
wp-includes/revision.php: _wp_preview_terms_filter() |
Filters terms lookup to set the post format. |
wp-admin/includes/class-wp-screen.php: WP_Screen::get() |
Fetches a screen object. |
wp-admin/includes/misc.php: set_screen_options() |
Saves option for number of rows when listing posts, pages, comments, etc. |
wp-admin/includes/class-wp-list-table.php: WP_List_Table::__construct() |
Constructor. |
wp-admin/includes/class-wp-comments-list-table.php: WP_Comments_List_Table::prepare_items() | |
wp-admin/includes/ajax-actions.php: wp_ajax_search_install_plugins() |
Ajax handler for searching plugins to install. |
wp-admin/includes/ajax-actions.php: wp_ajax_install_theme() |
Ajax handler for installing a theme. |
wp-admin/includes/ajax-actions.php: wp_ajax_install_plugin() |
Ajax handler for installing a plugin. |
wp-admin/includes/ajax-actions.php: wp_ajax_update_plugin() |
Ajax handler for updating a plugin. |
wp-admin/includes/ajax-actions.php: wp_ajax_delete_plugin() |
Ajax handler for deleting a plugin. |
wp-admin/includes/ajax-actions.php: wp_ajax_search_plugins() |
Ajax handler for searching plugins. |
wp-admin/includes/ajax-actions.php: wp_ajax_heartbeat() |
Ajax handler for the Heartbeat API. |
wp-admin/includes/ajax-actions.php: wp_ajax_save_user_color_scheme() |
Ajax handler for auto-saving the selected color scheme for a user’s own profile. |
wp-admin/includes/ajax-actions.php: wp_ajax_dismiss_wp_pointer() |
Ajax handler for dismissing a ClassicPress pointer. |
wp-admin/includes/ajax-actions.php: wp_ajax_inline_save_tax() |
Ajax handler for quick edit saving for a term. |
wp-admin/includes/ajax-actions.php: wp_ajax_hidden_columns() |
Ajax handler for hidden columns. |
wp-admin/includes/ajax-actions.php: wp_ajax_meta_box_order() |
Ajax handler for saving the meta box order. |
wp-admin/includes/ajax-actions.php: wp_ajax_closed_postboxes() |
Ajax handler for closed post boxes. |
wp-admin/includes/ajax-actions.php: wp_ajax_get_tagcloud() |
Ajax handler for getting a tagcloud. |
wp-admin/includes/ajax-actions.php: wp_ajax_nopriv_heartbeat() |
Ajax handler for the Heartbeat API in the no-privilege context. |
wp-admin/includes/ajax-actions.php: wp_ajax_ajax_tag_search() |
Ajax handler for tag search. |
wp-admin/includes/user.php: _wp_personal_data_handle_actions() |
Handle list table actions. |
wp-admin/includes/export.php: export_wp() |
Generates the WXR export file for download. |
wp-admin/includes/post.php: post_preview() |
Saves a draft or manually autosaves for the purpose of showing a post preview. |
wp-admin/includes/post.php: _wp_translate_postdata() |
Rename $_POST data from form names to DB post columns. |
wp-admin/includes/post.php: edit_post() |
Update an existing post with values provided in $_POST. |
wp-admin/includes/post.php: bulk_edit_posts() |
Process the post data for the bulk editing of posts. |
wp-admin/includes/ms.php: update_user_status() |
Update the status of a user in the database. |
Changelog
Version | Description |
---|---|
WP-3.0.0 | Introduced. |