admin_url() - WordPress 函数参考中文文档

返回介绍

admin_url()

发布于 2017-09-10 字数9628 浏览 1124 评论 0

admin_url( string $path = '',  string $scheme = 'admin' )

Retrieves the URL to the admin area for the current site.


描述


参数

$path

(string)
(Optional)
path relative to the admin URL.

Default value: ”

$scheme

(string)
(Optional)
The scheme to use. Default is ‘admin’, which obeys force_ssl_admin() and is_ssl(). ‘http’ or ‘https’ can be passed to force those schemes.

Default value: ‘admin’


返回值

(string) Admin URL link with optional path appended.


源代码

File: wp-includes/link-template.php

function admin_url( $path = '', $scheme = 'admin' ) {
	return get_admin_url( null, $path, $scheme );
}

更新日志

Version 描述
2.6.0 Introduced.

相关函数

Uses

  • wp-includes/link-template.php:
    get_admin_url()

Used By

  • wp-includes/widgets/class-wp-widget-media-audio.php:
    WP_Widget_Media_Audio::__construct()
  • wp-includes/widgets/class-wp-widget-media-video.php:
    WP_Widget_Media_Video::__construct()
  • wp-includes/widgets/class-wp-widget-media.php:
    WP_Widget_Media::__construct()
  • wp-includes/widgets/class-wp-widget-media-image.php:
    WP_Widget_Media_Image::__construct()
  • wp-admin/includes/dashboard.php:
    wp_print_community_events_markup()
  • wp-includes/class-wp-customize-manager.php:
    WP_Customize_Manager::is_cross_domain()
  • wp-includes/class-wp-customize-manager.php:
    WP_Customize_Manager::filter_iframe_security_headers()
  • wp-admin/includes/ajax-actions.php:
    wp_ajax_install_theme()
  • wp-admin/includes/ajax-actions.php:
    wp_ajax_install_plugin()
  • wp-includes/embed.php:
    the_embed_site_title()
  • wp-includes/customize/class-wp-customize-site-icon-control.php:
    WP_Customize_Site_Icon_Control::content_template()
  • wp-includes/class-wp-customize-manager.php:
    WP_Customize_Manager::customize_pane_settings()
  • wp-admin/includes/class-wp-posts-list-table.php:
    WP_Posts_List_Table::handle_row_actions()
  • wp-admin/includes/class-wp-press-this.php:
    WP_Press_This::html()
  • wp-admin/includes/class-wp-press-this.php:
    WP_Press_This::add_editor_style()
  • wp-admin/includes/network.php:
    network_step1()
  • wp-admin/includes/class-wp-automatic-updater.php:
    WP_Automatic_Updater::send_email()
  • wp-admin/includes/theme.php:
    wp_prepare_themes_for_js()
  • wp-admin/includes/theme.php:
    get_theme_update_available()
  • wp-admin/includes/class-wp-plugins-list-table.php:
    WP_Plugins_List_Table::no_items()
  • wp-admin/includes/class-theme-upgrader-skin.php:
    Theme_Upgrader_Skin::after()
  • wp-admin/includes/class-plugin-installer-skin.php:
    Plugin_Installer_Skin::after()
  • wp-admin/includes/class-theme-installer-skin.php:
    Theme_Installer_Skin::after()
  • wp-admin/includes/class-wp-list-table.php:
    WP_List_Table::comments_bubble()
  • wp-admin/includes/image-edit.php:
    wp_image_editor()
  • wp-admin/includes/dashboard.php:
    wp_welcome_panel()
  • wp-admin/includes/dashboard.php:
    wp_dashboard_quota()
  • wp-admin/includes/dashboard.php:
    wp_dashboard_quick_press()
  • wp-admin/includes/dashboard.php:
    wp_dashboard_recent_drafts()
  • wp-admin/includes/plugin.php:
    menu_page_url()
  • wp-admin/includes/upgrade.php:
    wp_install_defaults()
  • wp-admin/includes/template.php:
    iframe_header()
  • wp-admin/includes/class-wp-themes-list-table.php:
    WP_Themes_List_Table::no_items()
  • wp-admin/includes/media.php:
    media_upload_type_form()
  • wp-admin/includes/media.php:
    media_upload_type_url_form()
  • wp-admin/includes/media.php:
    media_upload_gallery_form()
  • wp-admin/includes/media.php:
    media_upload_library_form()
  • wp-admin/includes/media.php:
    media_upload_flash_bypass()
  • wp-admin/includes/media.php:
    media_upload_max_image_resize()
  • wp-admin/includes/media.php:
    media_upload_form()
  • wp-admin/includes/media.php:
    wp_iframe()
  • wp-admin/includes/media.php:
    get_upload_iframe_src()
  • wp-admin/includes/post.php:
    _admin_notice_post_locked()
  • wp-admin/includes/ajax-actions.php:
    wp_ajax_query_themes()
  • wp-admin/includes/update-core.php:
    update_core()
  • wp-admin/includes/revision.php:
    wp_prepare_revisions_for_js()
  • wp-admin/includes/class-wp-comments-list-table.php:
    WP_Comments_List_Table::column_author()
  • wp-admin/includes/class-wp-comments-list-table.php:
    WP_Comments_List_Table::get_views()
  • wp-admin/includes/class-walker-nav-menu-edit.php:
    Walker_Nav_Menu_Edit::start_el()
  • wp-admin/custom-header.php:
    Custom_Image_Header::step_1()
  • wp-admin/custom-header.php:
    Custom_Image_Header::help()
  • wp-admin/custom-background.php:
    Custom_Background::admin_page()
  • wp-includes/theme.php:
    wp_customize_url()
  • wp-includes/theme.php:
    wp_customize_support_script()
  • wp-includes/theme.php:
    _wp_customize_loader_settings()
  • wp-includes/pluggable.php:
    wp_safe_redirect()
  • wp-includes/pluggable.php:
    wp_notify_postauthor()
  • wp-includes/pluggable.php:
    wp_notify_moderator()
  • wp-includes/pluggable.php:
    check_admin_referer()
  • wp-includes/general-template.php:
    wp_heartbeat_settings()
  • wp-includes/general-template.php:
    register_admin_color_schemes()
  • wp-includes/general-template.php:
    wp_admin_css_uri()
  • wp-includes/general-template.php:
    wp_register()
  • wp-includes/deprecated.php:
    wp_admin_bar_dashboard_view_site_menu()
  • wp-includes/widgets/class-wp-nav-menu-widget.php:
    WP_Nav_Menu_Widget::form()
  • wp-includes/class-wp-embed.php:
    WP_Embed::maybe_run_ajax_cache()
  • wp-includes/link-template.php:
    self_admin_url()
  • wp-includes/link-template.php:
    get_dashboard_url()
  • wp-includes/link-template.php:
    network_admin_url()
  • wp-includes/link-template.php:
    get_shortcut_link()
  • wp-includes/link-template.php:
    get_edit_post_link()
  • wp-includes/link-template.php:
    get_delete_post_link()
  • wp-includes/link-template.php:
    get_edit_comment_link()
  • wp-includes/link-template.php:
    get_edit_bookmark_link()
  • wp-includes/link-template.php:
    get_edit_term_link()
  • wp-includes/http.php:
    get_allowed_http_origins()
  • wp-includes/admin-bar.php:
    wp_admin_bar_site_menu()
  • wp-includes/admin-bar.php:
    wp_admin_bar_my_sites_menu()
  • wp-includes/admin-bar.php:
    wp_admin_bar_new_content_menu()
  • wp-includes/admin-bar.php:
    wp_admin_bar_comments_menu()
  • wp-includes/admin-bar.php:
    wp_admin_bar_appearance_menu()
  • wp-includes/option.php:
    wp_user_settings()
  • wp-includes/media.php:
    wp_plupload_default_settings()
  • wp-includes/media.php:
    wp_enqueue_media()
  • wp-includes/canonical.php:
    wp_redirect_admin_locations()
  • wp-includes/ms-functions.php:
    maybe_add_existing_user_to_blog()
  • wp-includes/script-loader.php:
    wp_default_scripts()
  • wp-includes/class-wp-editor.php:
    _WP_Editors::editor_js()
  • wp-includes/media-template.php:
    wp_print_media_templates()
  • Show 84 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: 1You must log in to vote on the helpfulness of this note

    Contributed by Codex

    Usage

    <?php admin_url( $path, $scheme ); ?>
  2. Default Usage

    <?php $url = admin_url(); ?>

    Examples

    <?php echo admin_url(); ?>

    Output: http://example.com/wp-admin/ (or https protocol when appropriate)

    // Generate URL to admin's "Categories" page, and force https
    <?php echo admin_url( 'edit-tags.php?taxonomy=category', 'https' ); ?>

    Output: https://example.com/wp-admin/edit-tags.php?taxonomy=category

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!