wp_slash( string|array $value )
Add slashes to a string or array of strings.
Description
This should be used when preparing data for core API that expects slashed data. This should not be used to escape data going directly into an SQL query.
Parameters
- $value
-
(string|array) (Required) String or array of strings to slash.
Return
(string|array) Slashed $value
Source
File: wp-includes/formatting.php
function wp_slash( $value ) {
if ( is_array( $value ) ) {
foreach ( $value as $k => $v ) {
if ( is_array( $v ) ) {
$value[$k] = wp_slash( $v );
} else {
$value[$k] = addslashes( $v );
}
}
} else {
$value = addslashes( $value );
}
return $value;
}
Related
Uses
Uses | Description |
---|---|
wp-includes/formatting.php: wp_slash() |
Add slashes to a string or array of strings. |
Used By
Used By | Description |
---|---|
wp-includes/customize/class-wp-customize-nav-menu-setting.php: WP_Customize_Nav_Menu_Setting::update() |
Create/update the nav_menu term for this setting. |
wp-includes/customize/class-wp-customize-nav-menu-item-setting.php: WP_Customize_Nav_Menu_Item_Setting::sanitize() |
Sanitize an input. |
wp-includes/customize/class-wp-customize-nav-menu-item-setting.php: WP_Customize_Nav_Menu_Item_Setting::update() |
Creates/updates the nav_menu_item post for this setting. |
wp-includes/rest-api/fields/class-wp-rest-meta-fields.php: WP_REST_Meta_Fields::delete_meta_value() |
Deletes a meta value for an object. |
wp-includes/rest-api/fields/class-wp-rest-meta-fields.php: WP_REST_Meta_Fields::update_multi_meta_value() |
Updates multiple meta values for an object. |
wp-includes/rest-api/fields/class-wp-rest-meta-fields.php: WP_REST_Meta_Fields::update_meta_value() |
Updates a meta value for an object. |
wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php: WP_REST_Comments_Controller::create_item() |
Creates a comment. |
wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php: WP_REST_Comments_Controller::update_item() |
Updates a comment. |
wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php: WP_REST_Users_Controller::create_item() |
Creates a single user. |
wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php: WP_REST_Users_Controller::update_item() |
Updates a single user. |
wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php: WP_REST_Terms_Controller::create_item() |
Creates a single term in a taxonomy. |
wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php: WP_REST_Terms_Controller::update_item() |
Updates a single term from a taxonomy. |
wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php: WP_REST_Attachments_Controller::create_item() |
Creates a single attachment. |
wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php: WP_REST_Posts_Controller::update_item() |
Updates a single post. |
wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php: WP_REST_Posts_Controller::create_item() |
Creates a single post. |
wp-includes/class-wp-customize-widgets.php: WP_Customize_Widgets::call_widget_update() |
Finds and invokes the widget update and control callbacks. |
wp-includes/comment.php: wp_handle_comment_submission() |
Handles the submission of a comment, usually posted to wp-comments-post.php via a comment form. |
wp-includes/comment.php: wp_update_comment() |
Updates an existing comment in the database. |
wp-includes/class-wp-embed.php: WP_Embed::shortcode() |
The do_shortcode() callback function. |
wp-includes/user.php: wp_create_user() |
A simpler way of inserting a user into the database. |
wp-includes/theme.php: wp_update_custom_css_post() |
Update the |
wp-includes/class-wp-xmlrpc-server.php: wp_xmlrpc_server::escape() |
Escape string or array of strings for database. |
wp-includes/class-wp-customize-manager.php: WP_Customize_Manager::save_changeset_post() |
Save the post for the loaded changeset. |
wp-includes/post.php: wp_update_post() |
Update a post with new post data. |
wp-includes/class-wp-customize-nav-menus.php: WP_Customize_Nav_Menus::insert_auto_draft_post() |
Add a new |
wp-includes/class-wp-customize-nav-menus.php: WP_Customize_Nav_Menus::save_nav_menus_created_posts() |
Publish the auto-draft posts that were created for nav menu items. |
wp-includes/formatting.php: wp_slash() |
Add slashes to a string or array of strings. |
wp-includes/formatting.php: wp_rel_nofollow() |
Adds rel nofollow string to all HTML A elements in content. |
wp-includes/formatting.php: addslashes_gpc() |
Adds slashes to escape strings. |
wp-includes/taxonomy.php: wp_update_term() |
Update term based on arguments provided. |
wp-includes/revision.php: _wp_put_post_revision() |
Inserts post data into the posts table as a post revision. |
wp-includes/revision.php: wp_restore_post_revision() |
Restores a post to the specified revision. |
wp-admin/includes/media.php: media_upload_form_handler() |
Handles form submissions for the legacy media uploader. |
wp-admin/includes/bookmark.php: wp_update_link() |
Updates a link in the database. |
wp-admin/includes/ajax-actions.php: wp_ajax_save_attachment() |
Ajax handler for updating attachment attributes. |
wp-admin/includes/ajax-actions.php: wp_ajax_inline_save() |
Ajax handler for Quick Edit saving a post from a list table. |
wp-admin/includes/ajax-actions.php: wp_ajax_replyto_comment() |
Ajax handler for replying to a comment. |
wp-admin/includes/user.php: edit_user() |
Edit user settings based on contents of $_POST |
wp-admin/includes/post.php: wp_autosave() |
Save a post submitted with XHR |
wp-admin/includes/post.php: edit_post() |
Update an existing post with values provided in $_POST. |
wp-admin/includes/post.php: add_meta() |
Add post meta data defined in $_POST superglobal for post with given ID. |
wp-admin/includes/taxonomy.php: wp_update_category() |
Aliases wp_insert_category() with minimal args. |
Changelog
Version | Description |
---|---|
WP-3.6.0 | Introduced. |