返回介绍

_deprecated_function()

发布于 2017-09-11 10:12:48 字数 25189 浏览 1114 评论 0 收藏 0

Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

_deprecated_function( string $function,  string $version,  string $replacement = null )

Mark a function as deprecated and inform when it has been used.


description

There is a ‘hook deprecated_function_run’ that will be called that can be used to get the backtrace up to what file and function called the deprecated function.

The current behavior is to trigger a user error if WP_DEBUG is true.

This function is to be used in every function that is deprecated.


参数

$function

(string) (Required) The function that was called.

$version

(string) (Required) The version of WordPress that deprecated the function.

$replacement

(string) (Optional) The function that should have been called.

Default value: null


源代码

File: wp-includes/functions.php

function _deprecated_function( $function, $version, $replacement = null ) {

	/**
	 * Fires when a deprecated function is called.
	 *
	 * @since 2.5.0
	 *
	 * @param string $function    The function that was called.
	 * @param string $replacement The function that should have been called.
	 * @param string $version     The version of WordPress that deprecated the function.
	 */
	do_action( 'deprecated_function_run', $function, $replacement, $version );

	/**
	 * Filters whether to trigger an error for deprecated functions.
	 *
	 * @since 2.5.0
	 *
	 * @param bool $trigger Whether to trigger the error for deprecated functions. Default true.
	 */
	if ( WP_DEBUG && apply_filters( 'deprecated_function_trigger_error', true ) ) {
		if ( function_exists( '__' ) ) {
			if ( ! is_null( $replacement ) ) {
				/* translators: 1: PHP function name, 2: version number, 3: alternative function name */
				trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $function, $version, $replacement ) );
			} else {
				/* translators: 1: PHP function name, 2: version number */
				trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version ) );
			}
		} else {
			if ( ! is_null( $replacement ) ) {
				trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', $function, $version, $replacement ) );
			} else {
				trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', $function, $version ) );
			}
		}
	}
}

更新日志

Versiondescription
2.5.0Introduced.

相关函数

Uses

  • wp-includes/l10n.php: __()
  • wp-includes/functions.php: deprecated_function_run
  • wp-includes/functions.php: deprecated_function_trigger_error
  • wp-includes/plugin.php: do_action()
  • wp-includes/plugin.php: apply_filters()

Used By

  • wp-includes/class-wp-query.php: WP_Query::lazyload_term_meta()
  • wp-includes/class-wp-query.php: WP_Query::lazyload_comment_meta()
  • wp-includes/customize/class-wp-customize-nav-menu-setting.php: WP_Customize_Nav_Menu_Setting::_sort_menus_by_orderby()
  • wp-includes/customize/class-wp-customize-nav-menus-panel.php: WP_Customize_Nav_Menus_Panel::wp_nav_menu_manage_columns()
  • wp-admin/includes/deprecated.php: WP_User_Search::__construct()
  • wp-includes/class-http.php: WP_Http::parse_url()
  • wp-includes/class-wp-customize-manager.php: WP_Customize_Manager::customize_preview_override_404_status()
  • wp-admin/includes/deprecated.php: post_form_autocomplete_off()
  • xmlrpc.php: logIO()
  • wp-admin/includes/deprecated.php: _relocate_children()
  • wp-admin/includes/deprecated.php: get_post_to_edit()
  • wp-admin/includes/deprecated.php: get_default_page_to_edit()
  • wp-admin/includes/deprecated.php: wp_create_thumbnail()
  • wp-admin/includes/deprecated.php: wp_nav_menu_locations_meta_box()
  • wp-admin/includes/deprecated.php: wp_update_core()
  • wp-admin/includes/deprecated.php: wp_update_plugin()
  • wp-admin/includes/deprecated.php: wp_update_theme()
  • wp-admin/includes/deprecated.php: the_attachment_links()
  • wp-admin/includes/deprecated.php: wp_print_editor_js()
  • wp-admin/includes/deprecated.php: wp_quicktags()
  • wp-admin/includes/deprecated.php: screen_layout()
  • wp-admin/includes/deprecated.php: screen_options()
  • wp-admin/includes/deprecated.php: favorite_actions()
  • wp-admin/includes/deprecated.php: media_upload_image()
  • wp-admin/includes/deprecated.php: media_upload_audio()
  • wp-admin/includes/deprecated.php: media_upload_video()
  • wp-admin/includes/deprecated.php: media_upload_file()
  • wp-admin/includes/deprecated.php: type_url_form_image()
  • wp-admin/includes/deprecated.php: type_url_form_audio()
  • wp-admin/includes/deprecated.php: type_url_form_video()
  • wp-admin/includes/deprecated.php: type_url_form_file()
  • wp-admin/includes/deprecated.php: add_contextual_help()
  • wp-admin/includes/deprecated.php: get_allowed_themes()
  • wp-admin/includes/deprecated.php: get_broken_themes()
  • wp-admin/includes/deprecated.php: current_theme_info()
  • wp-admin/includes/deprecated.php: _insert_into_post_button()
  • wp-admin/includes/deprecated.php: _media_button()
  • wp-admin/includes/deprecated.php: dropdown_categories()
  • wp-admin/includes/deprecated.php: dropdown_link_categories()
  • wp-admin/includes/deprecated.php: get_real_file_to_edit()
  • wp-admin/includes/deprecated.php: wp_dropdown_cats()
  • wp-admin/includes/deprecated.php: add_option_update_handler()
  • wp-admin/includes/deprecated.php: remove_option_update_handler()
  • wp-admin/includes/deprecated.php: codepress_get_lang()
  • wp-admin/includes/deprecated.php: codepress_footer_js()
  • wp-admin/includes/deprecated.php: use_codepress()
  • wp-admin/includes/deprecated.php: get_author_user_ids()
  • wp-admin/includes/deprecated.php: get_editable_authors()
  • wp-admin/includes/deprecated.php: get_editable_user_ids()
  • wp-admin/includes/deprecated.php: get_nonauthor_user_ids()
  • wp-admin/includes/deprecated.php: get_others_unpublished_posts()
  • wp-admin/includes/deprecated.php: get_others_drafts()
  • wp-admin/includes/deprecated.php: get_others_pending()
  • wp-admin/includes/deprecated.php: wp_dashboard_quick_press_output()
  • wp-admin/includes/deprecated.php: wp_tiny_mce()
  • wp-admin/includes/deprecated.php: wp_preload_dialogs()
  • wp-admin/includes/theme-install.php: install_themes_feature_list()
  • wp-admin/includes/theme-install.php: display_theme()
  • wp-admin/includes/deprecated.php: tinymce_include()
  • wp-admin/includes/deprecated.php: documentation_link()
  • wp-admin/includes/deprecated.php: wp_shrink_dimensions()
  • wp-admin/includes/deprecated.php: get_udims()
  • wp-admin/includes/class-wp-filesystem-base.php: WP_Filesystem_Base::find_base_dir()
  • wp-admin/includes/class-wp-filesystem-base.php: WP_Filesystem_Base::get_base_dir()
  • wp-admin/includes/deprecated.php: wp_dashboard_plugins_output()
  • wp-admin/includes/deprecated.php: add_object_page()
  • wp-admin/includes/deprecated.php: add_utility_page()
  • wp-admin/includes/ms-deprecated.php: wpmu_menu()
  • wp-admin/includes/ms-deprecated.php: wpmu_checkAvailableSpace()
  • wp-admin/includes/ms-deprecated.php: mu_options()
  • wp-admin/includes/ms-deprecated.php: activate_sitewide_plugin()
  • wp-admin/includes/ms-deprecated.php: deactivate_sitewide_plugin()
  • wp-admin/includes/ms-deprecated.php: is_wpmu_sitewide_plugin()
  • wp-admin/includes/ms-deprecated.php: get_site_allowed_themes()
  • wp-admin/includes/ms-deprecated.php: wpmu_get_blog_allowedthemes()
  • wp-includes/class-wp-roles.php: WP_Roles::reinit()
  • wp-includes/class-wp-customize-manager.php: WP_Customize_Manager::_cmp_priority()
  • wp-includes/class-wp-customize-manager.php: WP_Customize_Manager::customize_preview_base()
  • wp-includes/class-wp-customize-manager.php: WP_Customize_Manager::customize_preview_html5()
  • wp-includes/class-wp-customize-manager.php: WP_Customize_Manager::customize_preview_signature()
  • wp-includes/class-wp-customize-manager.php: WP_Customize_Manager::remove_preview_signature()
  • wp-includes/class-wp-customize-manager.php: WP_Customize_Manager::wp_die_handler()
  • wp-includes/class-wp-customize-manager.php: WP_Customize_Manager::wp_redirect_status()
  • wp-includes/cache.php: WP_Object_Cache::reset()
  • wp-includes/cache.php: wp_cache_reset()
  • wp-includes/deprecated.php: _usort_terms_by_name()
  • wp-includes/deprecated.php: _usort_terms_by_ID()
  • wp-includes/deprecated.php: preview_theme()
  • wp-includes/deprecated.php: _preview_theme_template_filter()
  • wp-includes/deprecated.php: _preview_theme_stylesheet_filter()
  • wp-includes/deprecated.php: preview_theme_ob_filter()
  • wp-includes/deprecated.php: preview_theme_ob_filter_callback()
  • wp-includes/deprecated.php: like_escape()
  • wp-includes/deprecated.php: wp_htmledit_pre()
  • wp-includes/deprecated.php: popuplinks()
  • wp-includes/deprecated.php: wp_richedit_pre()
  • wp-includes/pluggable-deprecated.php: get_currentuserinfo()
  • wp-includes/deprecated.php: gd_edit_image_support()
  • wp-includes/deprecated.php: wp_convert_bytes_to_hr()
  • wp-includes/deprecated.php: _search_terms_tidy()
  • wp-includes/deprecated.php: rich_edit_exists()
  • wp-includes/deprecated.php: format_to_post()
  • wp-includes/deprecated.php: clean_pre()
  • wp-includes/deprecated.php: add_custom_image_header()
  • wp-includes/deprecated.php: remove_custom_image_header()
  • wp-includes/deprecated.php: add_custom_background()
  • wp-includes/deprecated.php: remove_custom_background()
  • wp-includes/deprecated.php: get_theme_data()
  • wp-includes/deprecated.php: update_page_cache()
  • wp-includes/deprecated.php: clean_page_cache()
  • wp-includes/deprecated.php: wp_explain_nonce()
  • wp-includes/deprecated.php: sticky_class()
  • wp-includes/deprecated.php: _get_post_ancestors()
  • wp-includes/deprecated.php: wp_load_image()
  • wp-includes/deprecated.php: image_resize()
  • wp-includes/deprecated.php: wp_get_single_post()
  • wp-includes/deprecated.php: user_pass_ok()
  • wp-includes/deprecated.php: get_user_metavalues()
  • wp-includes/deprecated.php: sanitize_user_object()
  • wp-includes/deprecated.php: get_boundary_post_rel_link()
  • wp-includes/deprecated.php: start_post_rel_link()
  • wp-includes/deprecated.php: get_index_rel_link()
  • wp-includes/deprecated.php: index_rel_link()
  • wp-includes/deprecated.php: get_parent_post_rel_link()
  • wp-includes/deprecated.php: parent_post_rel_link()
  • wp-includes/deprecated.php: wp_admin_bar_dashboard_view_site_menu()
  • wp-includes/deprecated.php: is_blog_user()
  • wp-includes/deprecated.php: debug_fopen()
  • wp-includes/deprecated.php: debug_fwrite()
  • wp-includes/deprecated.php: debug_fclose()
  • wp-includes/deprecated.php: get_themes()
  • wp-includes/deprecated.php: get_theme()
  • wp-includes/deprecated.php: get_current_theme()
  • wp-includes/deprecated.php: register_widget_control()
  • wp-includes/deprecated.php: unregister_widget_control()
  • wp-includes/deprecated.php: delete_usermeta()
  • wp-includes/deprecated.php: get_usermeta()
  • wp-includes/deprecated.php: update_usermeta()
  • wp-includes/deprecated.php: get_users_of_blog()
  • wp-includes/deprecated.php: automatic_feed_links()
  • wp-includes/deprecated.php: get_profile()
  • wp-includes/deprecated.php: get_usernumposts()
  • wp-includes/deprecated.php: funky_javascript_fix()
  • wp-includes/deprecated.php: is_taxonomy()
  • wp-includes/deprecated.php: is_term()
  • wp-includes/deprecated.php: is_plugin_page()
  • wp-includes/deprecated.php: update_category_cache()
  • wp-includes/deprecated.php: wp_timezone_supported()
  • wp-includes/deprecated.php: the_editor()
  • wp-includes/deprecated.php: __ngettext()
  • wp-includes/deprecated.php: __ngettext_noop()
  • wp-includes/deprecated.php: get_alloptions()
  • wp-includes/deprecated.php: get_the_attachment_link()
  • wp-includes/deprecated.php: get_attachment_icon_src()
  • wp-includes/deprecated.php: get_attachment_icon()
  • wp-includes/deprecated.php: get_attachment_innerHTML()
  • wp-includes/deprecated.php: get_link()
  • wp-includes/deprecated.php: sanitize_url()
  • wp-includes/deprecated.php: clean_url()
  • wp-includes/deprecated.php: js_escape()
  • wp-includes/deprecated.php: wp_specialchars()
  • wp-includes/deprecated.php: attribute_escape()
  • wp-includes/deprecated.php: register_sidebar_widget()
  • wp-includes/deprecated.php: unregister_sidebar_widget()
  • wp-includes/deprecated.php: get_the_author_icq()
  • wp-includes/deprecated.php: the_author_icq()
  • wp-includes/deprecated.php: get_the_author_yim()
  • wp-includes/deprecated.php: the_author_yim()
  • wp-includes/deprecated.php: get_the_author_msn()
  • wp-includes/deprecated.php: the_author_msn()
  • wp-includes/deprecated.php: get_the_author_aim()
  • wp-includes/deprecated.php: the_author_aim()
  • wp-includes/deprecated.php: get_author_name()
  • wp-includes/deprecated.php: get_the_author_url()
  • wp-includes/deprecated.php: the_author_url()
  • wp-includes/deprecated.php: get_the_author_ID()
  • wp-includes/deprecated.php: the_author_ID()
  • wp-includes/deprecated.php: the_content_rss()
  • wp-includes/deprecated.php: make_url_footnote()
  • wp-includes/deprecated.php: _c()
  • wp-includes/deprecated.php: translate_with_context()
  • wp-includes/deprecated.php: _nc()
  • wp-includes/deprecated.php: get_author_rss_link()
  • wp-includes/deprecated.php: comments_rss()
  • wp-includes/deprecated.php: create_user()
  • wp-includes/deprecated.php: gzip_compression()
  • wp-includes/deprecated.php: get_commentdata()
  • wp-includes/deprecated.php: get_catname()
  • wp-includes/deprecated.php: get_category_children()
  • wp-includes/deprecated.php: get_the_author_description()
  • wp-includes/deprecated.php: the_author_description()
  • wp-includes/deprecated.php: get_the_author_login()
  • wp-includes/deprecated.php: the_author_login()
  • wp-includes/deprecated.php: get_the_author_firstname()
  • wp-includes/deprecated.php: the_author_firstname()
  • wp-includes/deprecated.php: get_the_author_lastname()
  • wp-includes/deprecated.php: the_author_lastname()
  • wp-includes/deprecated.php: get_the_author_nickname()
  • wp-includes/deprecated.php: the_author_nickname()
  • wp-includes/deprecated.php: get_the_author_email()
  • wp-includes/deprecated.php: the_author_email()
  • wp-includes/deprecated.php: wp_set_post_cats()
  • wp-includes/deprecated.php: get_archives()
  • wp-includes/deprecated.php: get_author_link()
  • wp-includes/deprecated.php: link_pages()
  • wp-includes/deprecated.php: get_settings()
  • wp-includes/deprecated.php: permalink_link()
  • wp-includes/deprecated.php: permalink_single_rss()
  • wp-includes/deprecated.php: wp_get_links()
  • wp-includes/deprecated.php: get_links()
  • wp-includes/deprecated.php: get_links_list()
  • wp-includes/deprecated.php: links_popup_script()
  • wp-includes/deprecated.php: get_linkrating()
  • wp-includes/deprecated.php: get_linkcatname()
  • wp-includes/deprecated.php: comments_rss_link()
  • wp-includes/deprecated.php: get_category_rss_link()
  • wp-includes/deprecated.php: dropdown_cats()
  • wp-includes/deprecated.php: list_authors()
  • wp-includes/deprecated.php: wp_get_post_cats()
  • wp-includes/deprecated.php: user_can_create_post()
  • wp-includes/deprecated.php: user_can_create_draft()
  • wp-includes/deprecated.php: user_can_edit_post()
  • wp-includes/deprecated.php: user_can_delete_post()
  • wp-includes/deprecated.php: user_can_set_post_date()
  • wp-includes/deprecated.php: user_can_edit_post_date()
  • wp-includes/deprecated.php: user_can_edit_post_comments()
  • wp-includes/deprecated.php: user_can_delete_post_comments()
  • wp-includes/deprecated.php: user_can_edit_user()
  • wp-includes/deprecated.php: get_linksbyname()
  • wp-includes/deprecated.php: wp_get_linksbyname()
  • wp-includes/deprecated.php: get_linkobjectsbyname()
  • wp-includes/deprecated.php: get_linkobjects()
  • wp-includes/deprecated.php: get_linksbyname_withrating()
  • wp-includes/deprecated.php: get_links_withrating()
  • wp-includes/deprecated.php: get_autotoggle()
  • wp-includes/deprecated.php: list_cats()
  • wp-includes/deprecated.php: wp_list_cats()
  • wp-includes/deprecated.php: get_postdata()
  • wp-includes/deprecated.php: start_wp()
  • wp-includes/deprecated.php: the_category_ID()
  • wp-includes/deprecated.php: the_category_head()
  • wp-includes/deprecated.php: previous_post()
  • wp-includes/deprecated.php: next_post()
  • wp-includes/deprecated.php: wp_kses_js_entities()
  • wp-includes/class-wp-query.php: WP_Query::is_comments_popup()
  • wp-includes/deprecated.php: is_comments_popup()
  • wp-includes/deprecated.php: get_all_category_ids()
  • wp-includes/deprecated.php: force_ssl_login()
  • wp-includes/deprecated.php: url_is_accessable_via_ssl()
  • wp-includes/deprecated.php: wp_get_http()
  • wp-includes/widgets/class-wp-widget-recent-comments.php: WP_Widget_Recent_Comments::flush_widget_cache()
  • wp-includes/deprecated.php: post_permalink()
  • wp-includes/class-wp-admin-bar.php: WP_Admin_Bar::recursive_render()
  • wp-includes/class-wp-customize-setting.php: WP_Customize_Setting::_update_theme_mod()
  • wp-includes/class-wp-customize-setting.php: WP_Customize_Setting::_update_option()
  • wp-includes/pluggable-deprecated.php: wp_atom_server::__call()
  • wp-includes/pluggable-deprecated.php: wp_atom_server::__callStatic()
  • wp-includes/deprecated.php: get_comments_popup_template()
  • wp-includes/pluggable-deprecated.php: set_current_user()
  • wp-includes/pluggable-deprecated.php: get_userdatabylogin()
  • wp-includes/pluggable-deprecated.php: get_user_by_email()
  • wp-includes/pluggable-deprecated.php: wp_setcookie()
  • wp-includes/pluggable-deprecated.php: wp_clearcookie()
  • wp-includes/pluggable-deprecated.php: wp_get_cookie_login()
  • wp-includes/pluggable-deprecated.php: wp_login()
  • wp-includes/deprecated.php: get_paged_template()
  • wp-includes/deprecated.php: wp_embed_handler_googlevideo()
  • wp-includes/ms-deprecated.php: wp_get_sites()
  • wp-includes/ms-deprecated.php: get_admin_users_for_domain()
  • wp-includes/ms-deprecated.php: create_empty_blog()
  • wp-includes/ms-load.php: wp_get_network()
  • wp-includes/ms-load.php: get_current_site_name()
  • wp-includes/ms-load.php: wpmu_current_site()
  • wp-includes/ms-deprecated.php: generate_random_password()
  • wp-includes/ms-deprecated.php: is_site_admin()
  • wp-includes/ms-deprecated.php: graceful_fail()
  • wp-includes/ms-deprecated.php: get_user_details()
  • wp-includes/ms-deprecated.php: clear_global_post_cache()
  • wp-includes/ms-deprecated.php: is_main_blog()
  • wp-includes/ms-deprecated.php: validate_email()
  • wp-includes/ms-deprecated.php: get_blog_list()
  • wp-includes/ms-deprecated.php: get_most_active_blogs()
  • wp-includes/ms-deprecated.php: wpmu_admin_do_redirect()
  • wp-includes/ms-deprecated.php: wpmu_admin_redirect_add_updated_param()
  • wp-includes/ms-deprecated.php: get_user_id_from_string()
  • wp-includes/ms-deprecated.php: get_blogaddress_by_domain()
  • wp-includes/ms-deprecated.php: get_dashboard_blog()
  • wp-includes/class.wp-scripts.php: WP_Scripts::print_scripts_l10n()
  • wp-includes/deprecated.php: _sort_nav_menu_items()
  • wp-includes/wp-db.php: wpdb::supports_collation()
  • wp-includes/wp-db.php: wpdb::_weak_escape()
  • wp-includes/wp-db.php: wpdb::escape()
  • wp-includes/deprecated.php: comments_popup_script()
  • wp-includes/class-wp-customize-widgets.php: WP_Customize_Widgets::setup_widget_addition_previews()
  • wp-includes/class-wp-customize-widgets.php: WP_Customize_Widgets::prepreview_added_sidebars_widgets()
  • wp-includes/class-wp-customize-widgets.php: WP_Customize_Widgets::prepreview_added_widget_instance()
  • wp-includes/class-wp-customize-widgets.php: WP_Customize_Widgets::remove_prepreview_filters()
  • wp-includes/class-wp-editor.php: _WP_Editors::wp_fullscreen_html()
  • wp-includes/class-wp-editor.php: _WP_Editors::editor()
  • Show 294 more used by Hide more used by

User Contributed Notes

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

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

发布评论

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