返回介绍

wp_unslash()

发布于 2017-09-11 13:01:52 字数 11745 浏览 959 评论 0 收藏 0

wp_unslash( string|array $value )

Remove slashes from a string or array of strings.


description

This should be used to remove slashes from data passed to core API that expects data to be unslashed.


参数

$value

(string|array) (Required) String or array of strings to unslash.


返回值

(string|array) Unslashed $value


源代码

File: wp-includes/formatting.php

function wp_unslash( $value ) {
	return stripslashes_deep( $value );
}

更新日志

Versiondescription
3.6.0Introduced.

相关函数

Uses

  • wp-includes/formatting.php: stripslashes_deep()

Used By

  • wp-admin/includes/ajax-actions.php: wp_ajax_get_community_events()
  • wp-includes/class-wp-customize-nav-menus.php: WP_Customize_Nav_Menus::ajax_insert_auto_draft_post()
  • wp-admin/includes/ajax-actions.php: wp_ajax_delete_plugin()
  • wp-admin/includes/ajax-actions.php: wp_ajax_search_plugins()
  • wp-admin/includes/ajax-actions.php: wp_ajax_install_theme()
  • wp-admin/includes/ajax-actions.php: wp_ajax_update_theme()
  • wp-admin/includes/ajax-actions.php: wp_ajax_delete_theme()
  • wp-admin/includes/ajax-actions.php: wp_ajax_install_plugin()
  • wp-includes/functions.php: wp_get_raw_referer()
  • wp-includes/customize/class-wp-customize-selective-refresh.php: WP_Customize_Selective_Refresh::handle_render_partials_request()
  • wp-includes/rest-api/class-wp-rest-server.php: WP_REST_Server::serve_request()
  • wp-admin/includes/ajax-actions.php: wp_ajax_save_wporg_username()
  • wp-includes/customize/class-wp-customize-nav-menu-item-setting.php: WP_Customize_Nav_Menu_Item_Setting::sanitize()
  • wp-includes/class-wp-customize-nav-menus.php: WP_Customize_Nav_Menus::ajax_load_available_items()
  • wp-includes/class-wp-customize-nav-menus.php: WP_Customize_Nav_Menus::ajax_search_available_items()
  • wp-admin/includes/class-wp-terms-list-table.php: WP_Terms_List_Table::handle_row_actions()
  • wp-admin/includes/class-wp-ms-users-list-table.php: WP_MS_Users_List_Table::handle_row_actions()
  • wp-admin/includes/class-wp-ms-users-list-table.php: WP_MS_Users_List_Table::column_username()
  • wp-admin/includes/deprecated.php: WP_User_Search::__construct()
  • wp-includes/class-wp-customize-manager.php: WP_Customize_Manager::unsanitized_post_values()
  • wp-includes/class-wp-customize-widgets.php: WP_Customize_Widgets::register_settings()
  • wp-admin/includes/ajax-actions.php: wp_ajax_update_plugin()
  • wp-admin/includes/class-wp-press-this.php: WP_Press_This::merge_or_fetch_data()
  • wp-admin/includes/class-wp-press-this.php: WP_Press_This::side_load_images()
  • wp-includes/class-wp-session-tokens.php: WP_Session_Tokens::create()
  • wp-admin/includes/ajax-actions.php: wp_ajax_parse_embed()
  • wp-admin/includes/ajax-actions.php: wp_ajax_parse_media_shortcode()
  • wp-login.php: retrieve_password()
  • wp-signup.php: validate_another_blog_signup()
  • wp-signup.php: validate_blog_signup()
  • wp-admin/install.php: display_setup_form()
  • wp-admin/includes/theme.php: wp_prepare_themes_for_js()
  • wp-admin/includes/class-wp-ms-users-list-table.php: WP_MS_Users_List_Table::prepare_items()
  • wp-admin/includes/class-wp-plugins-list-table.php: WP_Plugins_List_Table::__construct()
  • wp-admin/includes/class-wp-plugins-list-table.php: WP_Plugins_List_Table::no_items()
  • wp-admin/includes/theme-install.php: install_theme_search_form()
  • wp-admin/includes/theme-install.php: install_theme_information()
  • wp-admin/includes/class-plugin-installer-skin.php: Plugin_Installer_Skin::after()
  • wp-admin/includes/image-edit.php: stream_preview_image()
  • wp-admin/includes/image-edit.php: wp_save_image()
  • wp-admin/includes/class-wp-ms-themes-list-table.php: WP_MS_Themes_List_Table::_search_callback()
  • wp-admin/includes/class-wp-theme-install-list-table.php: WP_Theme_Install_List_Table::prepare_items()
  • wp-admin/includes/plugin-install.php: install_search_form()
  • wp-admin/includes/plugin-install.php: install_plugin_install_status()
  • wp-admin/includes/plugin-install.php: install_plugin_information()
  • wp-admin/includes/dashboard.php: wp_dashboard_rss_control()
  • wp-admin/includes/user.php: edit_user()
  • wp-admin/includes/class-wp-plugin-install-list-table.php: WP_Plugin_Install_List_Table::prepare_items()
  • wp-admin/includes/template.php: _admin_search_query()
  • wp-admin/includes/class-wp-themes-list-table.php: WP_Themes_List_Table::prepare_items()
  • wp-admin/includes/class-wp-themes-list-table.php: WP_Themes_List_Table::_js_vars()
  • wp-admin/includes/class-wp-ms-sites-list-table.php: WP_MS_Sites_List_Table::prepare_items()
  • wp-admin/includes/class-wp-users-list-table.php: WP_Users_List_Table::single_row()
  • wp-admin/includes/class-wp-users-list-table.php: WP_Users_List_Table::prepare_items()
  • wp-admin/includes/media.php: media_upload_form_handler()
  • wp-admin/includes/media.php: wp_media_upload_handler()
  • wp-admin/includes/post.php: wp_create_post_autosave()
  • wp-admin/includes/post.php: add_meta()
  • wp-admin/includes/post.php: update_meta()
  • wp-admin/includes/ajax-actions.php: wp_ajax_send_attachment_to_editor()
  • wp-admin/includes/ajax-actions.php: wp_ajax_send_link_to_editor()
  • wp-admin/includes/ajax-actions.php: wp_ajax_heartbeat()
  • wp-admin/includes/ajax-actions.php: wp_ajax_query_themes()
  • wp-admin/includes/post.php: edit_post()
  • wp-admin/includes/post.php: get_default_post_to_edit()
  • wp-admin/includes/post.php: post_exists()
  • wp-admin/includes/ajax-actions.php: wp_ajax_date_format()
  • wp-admin/includes/ajax-actions.php: wp_ajax_time_format()
  • wp-admin/includes/ajax-actions.php: wp_ajax_save_attachment()
  • wp-admin/includes/ajax-actions.php: wp_ajax_add_meta()
  • wp-admin/includes/ajax-actions.php: wp_ajax_wp_link_ajax()
  • wp-admin/includes/ajax-actions.php: wp_ajax_find_posts()
  • wp-admin/includes/ajax-actions.php: wp_ajax_add_link_category()
  • wp-admin/includes/ajax-actions.php: wp_ajax_nopriv_heartbeat()
  • wp-admin/includes/ajax-actions.php: wp_ajax_ajax_tag_search()
  • wp-admin/includes/bookmark.php: wp_insert_link()
  • wp-admin/includes/bookmark.php: get_default_link_to_edit()
  • wp-admin/includes/class-wp-terms-list-table.php: WP_Terms_List_Table::column_name()
  • wp-admin/includes/class-wp-terms-list-table.php: WP_Terms_List_Table::prepare_items()
  • wp-admin/includes/file.php: request_filesystem_credentials()
  • wp-includes/class-wp-customize-manager.php: WP_Customize_Manager::customize_preview_settings()
  • wp-includes/class-wp-customize-manager.php: WP_Customize_Manager::save()
  • wp-includes/class-wp-customize-manager.php: WP_Customize_Manager::__construct()
  • wp-includes/class-wp-customize-manager.php: WP_Customize_Manager::doing_ajax()
  • wp-includes/cron.php: spawn_cron()
  • wp-includes/class-wp.php: WP::send_headers()
  • wp-includes/functions.php: wp_referer_field()
  • wp-includes/functions.php: wp_original_referer_field()
  • wp-includes/functions.php: wp_get_referer()
  • wp-includes/functions.php: wp_get_original_referer()
  • wp-includes/class-wp-tax-query.php: WP_Tax_Query::transform_query()
  • wp-includes/taxonomy.php: wp_update_term()
  • wp-includes/taxonomy.php: wp_insert_term()
  • wp-includes/taxonomy.php: term_exists()
  • wp-includes/feed.php: self_link()
  • wp-includes/user.php: wp_insert_user()
  • wp-includes/post-template.php: post_password_required()
  • wp-includes/post-template.php: _wp_link_page()
  • wp-includes/post.php: trackback_url_list()
  • wp-includes/post.php: get_pages()
  • wp-includes/post.php: wp_insert_post()
  • wp-includes/ms-functions.php: wpmu_log_new_registrations()
  • wp-includes/ms-functions.php: newblog_notify_siteadmin()
  • wp-includes/ms-functions.php: newuser_notify_siteadmin()
  • wp-includes/ms-functions.php: install_blog()
  • wp-includes/ms-functions.php: wpmu_welcome_notification()
  • wp-includes/ms-functions.php: wpmu_validate_blog_signup()
  • wp-includes/class-wp-xmlrpc-server.php: wp_xmlrpc_server::blogger_getPost()
  • wp-includes/class-wp-xmlrpc-server.php: wp_xmlrpc_server::blogger_getRecentPosts()
  • wp-includes/class-wp-xmlrpc-server.php: wp_xmlrpc_server::wp_setOptions()
  • wp-includes/class-wp-xmlrpc-server.php: wp_xmlrpc_server::set_custom_fields()
  • wp-includes/class-wp-customize-widgets.php: WP_Customize_Widgets::get_post_value()
  • wp-includes/comment.php: wp_update_comment()
  • wp-includes/comment.php: wp_insert_comment()
  • wp-includes/comment.php: sanitize_comment_cookies()
  • wp-includes/comment.php: wp_allow_comment()
  • wp-includes/comment.php: check_comment()
  • wp-includes/meta.php: delete_metadata()
  • wp-includes/meta.php: add_metadata()
  • wp-includes/meta.php: update_metadata()
  • Show 115 more used by Hide more used by

User Contributed Notes

  1. Skip to note content You must log in to vote on the helpfulness of this noteVote results for this note: 0You must log in to vote on the helpfulness of this note Contributed by Codex

    Example

    This function can be used in replacement of stripslashes_deep(). As it is a recursive function, when an array is given, it will remove slashes in all sub-arrays too.

    
    $arr = array(
    	"Is your name O\'reilly?",
    	"Person\'s Assets"
    );
    
    $arr = wp_unslash( $arr );
    /*
     Outputs: 
     array(
          "Is your name O'reilly?",
          "Person's Assets"
     );
    */
    

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文