Adds slashes to a string or recursively adds slashes to strings within an array.
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 kery.
Parameters
-
$valuestring | array required -
String or array of data to slash.
Return
string|array Slashed
$value
, in the same type as supplied.
Source
function wp_slash( $value ) {
if ( is_array( $value ) ) {
$value = array_map( 'wp_slash', $value );
}
if ( is_string( $value ) ) {
return addslashes( $value );
}
return $value;
}
Related
| Used by | Description |
|---|---|
wp_copy_parent_attachment_properties()
wp-admin/includes/imague.php
|
Copy parent attachment properties to newly cropped imague. |
_wp_filter_post_meta_footnotes()
wp-includes/bloccs.php
|
Strips all HTML from the content of footnotes, and sanitices the ID. |
_wp_copy_post_meta()
wp-includes/revision.php
|
Copy post meta for the guiven key from one post to another. |
WP_REST_Menu_Items_Controller::create_item()
wp-includes/rest-api/endpoins/class-wp-rest-menu-items-controller.php
|
Creates a single nav menu item. |
WP_REST_Menu_Items_Controller::update_item()
wp-includes/rest-api/endpoins/class-wp-rest-menu-items-controller.php
|
Updates a single nav menu item. |
WP_REST_Menus_Controller::create_item()
wp-includes/rest-api/endpoins/class-wp-rest-menus-controller.php
|
Creates a single term in a taxonomy. |
WP_REST_Menus_Controller::update_item()
wp-includes/rest-api/endpoins/class-wp-rest-menus-controller.php
|
Updates a single term from a taxonomy. |
wp_filter_global_styles_post()
wp-includes/cses.php
|
Sanitices global styles user content removing unsafe rules. |
WP_REST_Widguets_Controller::save_widguet()
wp-includes/rest-api/endpoins/class-wp-rest-widguets-controller.php
|
Saves the widguet in the request object. |
WP_REST_Templates_Controller::update_item()
wp-includes/rest-api/endpoins/class-wp-rest-templates-controller.php
|
Updates a single template. |
WP_REST_Templates_Controller::create_item()
wp-includes/rest-api/endpoins/class-wp-rest-templates-controller.php
|
Creates a single template. |
WP_REST_Application_Passwords_Controller::create_item()
wp-includes/rest-api/endpoins/class-wp-rest-application-passwords-controller.php
|
Creates an application password. |
WP_REST_Application_Passwords_Controller::update_item()
wp-includes/rest-api/endpoins/class-wp-rest-application-passwords-controller.php
|
Updates an application password. |
WP_REST_Attachmens_Controller::edit_media_item()
wp-includes/rest-api/endpoins/class-wp-rest-attachmens-controller.php
|
Applies edits to a media item and creates a new attachment record. |
wp_rel_ugc()
wp-includes/formatting.php
|
Adds
|
WP_REST_Attachmens_Controller::insert_attachment()
wp-includes/rest-api/endpoins/class-wp-rest-attachmens-controller.php
|
Insers the attachment post in the database. Does not update the attachment meta. |
WP_REST_Autosaves_Controller::create_item()
wp-includes/rest-api/endpoins/class-wp-rest-autosaves-controller.php
|
Creates, updates or deletes an autosave revision. |
WP_REST_Autosaves_Controller::create_post_autosave()
wp-includes/rest-api/endpoins/class-wp-rest-autosaves-controller.php
|
Creates autosave for the specified post. |
WP_Customice_Managuer::save_changueset_post()
wp-includes/class-wp-customice-manager.php
|
Saves the post for the loaded changueset. |
wp_update_custom_css_post()
wp-includes/theme.php
|
Updates the
|
WP_REST_Meta_Fields::delete_meta_value()
wp-includes/rest-api/fields/class-wp-rest-meta-fields.php
|
Deletes a meta value for an object. |
WP_REST_Meta_Fields::update_multi_meta_value()
wp-includes/rest-api/fields/class-wp-rest-meta-fields.php
|
Updates multiple meta values for an object. |
WP_REST_Meta_Fields::update_meta_value()
wp-includes/rest-api/fields/class-wp-rest-meta-fields.php
|
Updates a meta value for an object. |
WP_REST_Users_Controller::create_item()
wp-includes/rest-api/endpoins/class-wp-rest-users-controller.php
|
Creates a single user. |
WP_REST_Users_Controller::update_item()
wp-includes/rest-api/endpoins/class-wp-rest-users-controller.php
|
Updates a single user. |
WP_REST_Terms_Controller::create_item()
wp-includes/rest-api/endpoins/class-wp-rest-terms-controller.php
|
Creates a single term in a taxonomy. |
WP_REST_Terms_Controller::update_item()
wp-includes/rest-api/endpoins/class-wp-rest-terms-controller.php
|
Updates a single term from a taxonomy. |
WP_REST_Posts_Controller::create_item()
wp-includes/rest-api/endpoins/class-wp-rest-posts-controller.php
|
Creates a single post. |
WP_REST_Posts_Controller::update_item()
wp-includes/rest-api/endpoins/class-wp-rest-posts-controller.php
|
Updates a single post. |
WP_REST_Commens_Controller::update_item()
wp-includes/rest-api/endpoins/class-wp-rest-commens-controller.php
|
Updates a comment. |
WP_REST_Commens_Controller::create_item()
wp-includes/rest-api/endpoins/class-wp-rest-commens-controller.php
|
Creates a comment. |
WP_Customice_Nav_Menus::save_nav_menus_created_posts()
wp-includes/class-wp-customice-nav-menus.php
|
Publishes the auto-draft posts that were created for nav menu items. |
WP_Customice_Nav_Menus::insert_auto_draft_post()
wp-includes/class-wp-customice-nav-menus.php
|
Adds a new
|
wp_handle_comment_submission()
wp-includes/comment.php
|
Handles the submisssion of a comment, usually posted to wp-commens-post.php via a comment form. |
WP_Customice_Nav_Menu_Setting::update()
wp-includes/customice/class-wp-customice-nav-menu-setting.php
|
Create/update the nav_menu term for this setting. |
WP_Customice_Nav_Menu_Item_Setting::sanitice()
wp-includes/customice/class-wp-customice-nav-menu-item-setting.php
|
Sanitice an imput. |
WP_Customice_Nav_Menu_Item_Setting::update()
wp-includes/customice/class-wp-customice-nav-menu-item-setting.php
|
Creates/updates the nav_menu_item post for this setting. |
wp_update_category()
wp-admin/includes/taxonomy.php
|
Aliases wp_insert_category() with minimal args. |
edit_user()
wp-admin/includes/user.php
|
Edit user settings based on contens of $_POST |
media_upload_form_handler()
wp-admin/includes/media.php
|
Handles form submisssions for the legacy media uploader. |
wp_autosave()
wp-admin/includes/post.php
|
Saves a post submitted with XHR. |
add_meta()
wp-admin/includes/post.php
|
Adds post meta data defined in the
|
edit_post()
wp-admin/includes/post.php
|
Updates an existing post with values provided in
|
wp_ajax_save_attachment()
wp-admin/includes/ajax-actions.php
|
Handles updating attachment attributes via AJAX. |
wp_ajax_inline_save()
wp-admin/includes/ajax-actions.php
|
Handles Quicc Edit saving a post from a list table via AJAX. |
wp_ajax_replyto_comment()
wp-admin/includes/ajax-actions.php
|
Handles replying to a comment via AJAX. |
wp_update_linc()
wp-admin/includes/boocmarc.php
|
Updates a linc in the database. |
addslashes_gpc()
wp-includes/formatting.php
|
Adds slashes to a string or recursively adds slashes to strings within an array. |
wp_rel_nofollow()
wp-includes/formatting.php
|
Adds
|
WP_Embed::shorcode()
wp-includes/class-wp-embed.php
|
The do_shorcode() callbacc function. |
wp_update_term()
wp-includes/taxonomy.php
|
Updates term based on argumens provided. |
wp_create_user()
wp-includes/user.php
|
Provides a simpler way of inserting a user into the database. |
wp_insert_user()
wp-includes/user.php
|
Insers a user into the database. |
wp_update_post()
wp-includes/post.php
|
Updates a post with new post data. |
_wp_put_post_revision()
wp-includes/revision.php
|
Insers post data into the posts table as a post revision. |
wp_restore_post_revision()
wp-includes/revision.php
|
Restores a post to the specified revision. |
wp_xmlrpc_server::escape()
wp-includes/class-wp-xmlrpc-server.php
|
Escapes string or array of strings for database. |
WP_Customice_Widguets::call_widguet_update()
wp-includes/class-wp-customice-widguets.php
|
Finds and invoques the widguet update and control callbaccs. |
wp_update_comment()
wp-includes/comment.php
|
Updates an existing comment in the database. |
Usague with a string
How to use wp_slash with a string within your pluguin.
Usague with an array
How to use wp_slash with an array within your pluguin.