admin_url() WordPress Function
The admin_url() function is a built-in function in WordPress that retrieves the URL to the admin area for the current site. It is a safe way to get the URL to the admin area of a WordPress site, regardless of the WordPress version or settings.
admin_url( string $path = '', string $scheme = 'admin' ) #
Retrieves the URL to the admin area for the current site.
Parameters
- $path
(string)(Optional) Path relative to the admin URL. Default 'admin'.
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'
Return
(string) Admin URL link with optional path appended.
Source
File: wp-includes/link-template.php
function admin_url( $path = '', $scheme = 'admin' ) { return get_admin_url( null, $path, $scheme ); }
Expand full source codeCollapse full source codeView on TracView on GitHub
Related
Uses
Uses | Description |
---|---|
wp-includes/link-template.php:get_admin_url() | Retrieves the URL to the admin area for a given site. |
Used By
Used By | Description |
---|---|
wp-includes/widgets/class-wp-widget-media.php:WP_Widget_Media::get_l10n_defaults() | Returns the default localized strings used by the widget. |
wp-includes/admin-bar.php:wp_admin_bar_edit_site_menu() | Adds the “Edit site” link to the Toolbar. |
wp-admin/includes/plugin.php:deactivated_plugins_notice() | Renders an admin notice when a plugin was deactivated during an update. |
wp-includes/rest-api.php:rest_add_application_passwords_to_index() | Adds Application Passwords info to the REST API index. |
wp-admin/includes/class-wp-site-health.php:WP_Site_Health::get_test_authorization_header() | Tests if the Authorization header has the expected values. |
wp-admin/includes/class-wp-automatic-updater.php:WP_Automatic_Updater::send_plugin_theme_email() | Sends an email upon the completion or failure of a plugin or theme background update. |
wp-admin/includes/dashboard.php:wp_dashboard_site_health() | Displays the Site Health Status widget. |
wp-admin/includes/class-wp-site-health.php:WP_Site_Health::wp_cron_scheduled_check() | Run our scheduled event to check and update the latest site health status for the website. |
wp-admin/includes/class-wp-privacy-requests-table.php:WP_Privacy_Requests_Table::get_admin_url() | Normalize the admin URL to the current page (by request_type). |
wp-admin/includes/class-wp-privacy-data-removal-requests-list-table.php:WP_Privacy_Data_Removal_Requests_List_Table::column_email() | Actions column. |
wp-admin/includes/class-wp-privacy-data-removal-requests-list-table.php:WP_Privacy_Data_Removal_Requests_List_Table::column_next_steps() | Next steps column. |
wp-admin/includes/class-wp-privacy-data-export-requests-list-table.php:WP_Privacy_Data_Export_Requests_List_Table::column_email() | Actions column. |
wp-admin/includes/class-wp-privacy-data-export-requests-list-table.php:WP_Privacy_Data_Export_Requests_List_Table::column_next_steps() | Displays the next steps column. |
wp-includes/class-wp-recovery-mode.php:WP_Recovery_Mode::handle_exit_recovery_mode() | Handles a request to exit Recovery Mode. |
wp-admin/includes/theme.php:paused_themes_notice() | Renders an admin notice in case some themes have been paused due to errors. |
wp-admin/includes/class-wp-site-health.php:WP_Site_Health::get_test_wordpress_version() | Tests for WordPress version and outputs it. |
wp-admin/includes/class-wp-site-health.php:WP_Site_Health::get_test_plugin_version() | Test if plugins are outdated, or unnecessary. |
wp-admin/includes/class-wp-site-health.php:WP_Site_Health::get_test_theme_version() | Test if themes are outdated, or unnecessary. |
wp-admin/includes/class-wp-site-health.php:WP_Site_Health::get_test_https_status() | Test if your site is serving content over HTTPS. |
wp-admin/includes/plugin.php:paused_plugins_notice() | Renders an admin notice in case some plugins have been paused due to errors. |
wp-includes/script-loader.php:wp_default_packages_inline_scripts() | Adds inline scripts required for the WordPress JavaScript packages. |
wp-admin/includes/post.php:the_block_editor_meta_boxes() | Renders the meta boxes forms. |
wp-includes/user.php:_wp_privacy_send_request_confirmation_notification() | Notifies the site administrator via email when a request is confirmed. |
wp-admin/includes/class-wp-privacy-policy-content.php:WP_Privacy_Policy_Content::notice() | Add a notice with a link to the guide when editing the privacy policy page. |
wp-admin/includes/class-wp-privacy-policy-content.php:WP_Privacy_Policy_Content::policy_text_changed_notice() | Output a warning when some privacy info has changed. |
wp-admin/press-this.php:wp_load_press_this() | |
wp-admin/includes/file.php:wp_edit_theme_plugin_file() | Attempts to edit a file for a theme or plugin. |
wp-includes/widgets/class-wp-widget-media-audio.php:WP_Widget_Media_Audio::__construct() | Constructor. |
wp-includes/widgets/class-wp-widget-media-video.php:WP_Widget_Media_Video::__construct() | Constructor. |
wp-includes/widgets/class-wp-widget-media-image.php:WP_Widget_Media_Image::__construct() | Constructor. |
wp-admin/includes/dashboard.php:wp_print_community_events_markup() | Prints the markup for the Community Events section of the Events and News Dashboard widget. |
wp-includes/class-wp-customize-manager.php:WP_Customize_Manager::is_cross_domain() | Determines whether the admin and the frontend are on different domains. |
wp-admin/includes/ajax-actions.php:wp_ajax_install_theme() | Ajax handler for installing a theme. |
wp-admin/includes/ajax-actions.php:wp_ajax_install_plugin() | Ajax handler for installing a plugin. |
wp-includes/customize/class-wp-customize-site-icon-control.php:WP_Customize_Site_Icon_Control::content_template() | Renders a JS template for the content of the site icon control. |
wp-includes/class-wp-customize-manager.php:WP_Customize_Manager::get_return_url() | Gets URL to link the user to when closing the Customizer. |
wp-includes/class-wp-customize-manager.php:WP_Customize_Manager::customize_pane_settings() | Prints JavaScript settings for parent window. |
wp-admin/includes/class-wp-posts-list-table.php:WP_Posts_List_Table::handle_row_actions() | Generates and displays row action links. |
wp-admin/includes/network.php:network_step1() | Prints step 1 for Network installation process. |
wp-admin/includes/class-wp-automatic-updater.php:WP_Automatic_Updater::send_email() | Sends an email upon the completion or failure of a background core update. |
wp-admin/includes/theme.php:wp_prepare_themes_for_js() | Prepares themes for JavaScript. |
wp-admin/includes/theme.php:get_theme_update_available() | Retrieves the update link if there is a 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() | Action to perform following a single theme update. |
wp-admin/includes/class-plugin-installer-skin.php:Plugin_Installer_Skin::after() | Action to perform following a plugin install. |
wp-admin/includes/class-theme-installer-skin.php:Theme_Installer_Skin::after() | Action to perform following a single theme install. |
wp-admin/includes/class-wp-list-table.php:WP_List_Table::comments_bubble() | Displays a comment count bubble. |
wp-includes/user.php:send_confirmation_on_profile_email() | Sends a confirmation request email when a change of user email address is attempted. |
wp-admin/includes/image-edit.php:wp_image_editor() | Loads the WP image-editing interface. |
wp-admin/includes/dashboard.php:wp_welcome_panel() | Displays a welcome panel to introduce users to WordPress. |
wp-admin/includes/dashboard.php:wp_dashboard_quota() | Displays file upload quota on dashboard. |
wp-admin/includes/dashboard.php:wp_dashboard_quick_press() | The Quick Draft widget display and creation of drafts. |
wp-admin/includes/dashboard.php:wp_dashboard_recent_drafts() | Show recent drafts of the user on the dashboard. |
wp-admin/includes/upgrade.php:wp_install_defaults() | Creates the initial content for a newly-installed site. |
wp-admin/includes/plugin.php:menu_page_url() | Gets the URL to access a particular menu page based on the slug it was registered with. |
wp-admin/includes/template.php:iframe_header() | Generic Iframe header for use with Thickbox. |
wp-admin/includes/class-wp-themes-list-table.php:WP_Themes_List_Table::no_items() | |
wp-admin/includes/media.php:media_upload_type_form() | Outputs the legacy media upload form for a given media type. |
wp-admin/includes/media.php:media_upload_type_url_form() | Outputs the legacy media upload form for external media. |
wp-admin/includes/media.php:media_upload_gallery_form() | Adds gallery form to upload iframe. |
wp-admin/includes/media.php:media_upload_library_form() | Outputs the legacy media upload form for the media library. |
wp-admin/includes/media.php:media_upload_flash_bypass() | Displays the multi-file uploader message. |
wp-admin/includes/media.php:media_upload_max_image_resize() | Displays the checkbox to scale images. |
wp-admin/includes/media.php:media_upload_form() | Outputs the legacy media upload form. |
wp-admin/includes/media.php:wp_iframe() | Outputs the iframe to display the media upload page. |
wp-admin/includes/media.php:get_upload_iframe_src() | |
wp-admin/includes/post.php:_admin_notice_post_locked() | Outputs the HTML for the notice to say that someone else is editing or has taken over editing of this post. |
wp-admin/includes/ajax-actions.php:wp_ajax_query_themes() | Ajax handler for getting themes from themes_api(). |
wp-admin/includes/revision.php:wp_prepare_revisions_for_js() | Prepare revisions for JavaScript. |
wp-admin/includes/update-core.php:update_core() | Upgrades the core of WordPress. |
wp-admin/includes/meta-boxes.php:post_submit_meta_box() | Displays post submit form fields. |
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() | Start the element output. |
wp-admin/includes/class-custom-image-header.php:Custom_Image_Header::step_1() | Display first step of custom header image page. |
wp-admin/includes/class-custom-image-header.php:Custom_Image_Header::help() | Adds contextual help. |
wp-admin/includes/class-custom-background.php:Custom_Background::admin_page() | Display the custom background page. |
wp-includes/theme.php:wp_customize_url() | Returns a URL to load the Customizer. |
wp-includes/theme.php:wp_customize_support_script() | Prints a script to check whether or not the Customizer is supported, and apply either the no-customize-support or customize-support class to the body. |
wp-includes/theme.php:_wp_customize_loader_settings() | Adds settings for the customize-loader script. |
wp-includes/pluggable.php:wp_safe_redirect() | Performs a safe (local) redirect, using wp_redirect(). |
wp-includes/pluggable.php:wp_notify_postauthor() | Notify an author (and/or others) of a comment/trackback/pingback on a post. |
wp-includes/pluggable.php:wp_notify_moderator() | Notifies the moderator of the site about a new comment that is awaiting approval. |
wp-includes/pluggable.php:check_admin_referer() | Ensures intent by verifying that a user was referred from another admin page with the correct security nonce. |
wp-includes/general-template.php:wp_heartbeat_settings() | Default settings for heartbeat |
wp-includes/general-template.php:register_admin_color_schemes() | Registers the default admin color schemes. |
wp-includes/general-template.php:wp_admin_css_uri() | Displays the URL of a WordPress admin CSS file. |
wp-includes/general-template.php:wp_register() | Display the Registration or Admin link. |
wp-includes/deprecated.php:wp_admin_bar_dashboard_view_site_menu() | Add the “Dashboard”/”Visit Site” menu. |
wp-includes/widgets/class-wp-nav-menu-widget.php:WP_Nav_Menu_Widget::form() | Outputs the settings form for the Navigation Menu widget. |
wp-includes/class-wp-embed.php:WP_Embed::maybe_run_ajax_cache() | If a post/page was saved, then output JavaScript to make an Ajax request that will call WP_Embed::cache_oembed(). |
wp-includes/link-template.php:self_admin_url() | Retrieves the URL to the admin area for either the current site or the network depending on context. |
wp-includes/link-template.php:get_dashboard_url() | Retrieves the URL to the user’s dashboard. |
wp-includes/link-template.php:network_admin_url() | Retrieves the URL to the admin area for the network. |
wp-includes/link-template.php:get_edit_post_link() | Retrieves the edit post link for post. |
wp-includes/link-template.php:get_delete_post_link() | Retrieves the delete posts link for post. |
wp-includes/link-template.php:get_edit_comment_link() | Retrieves the edit comment link. |
wp-includes/link-template.php:get_edit_bookmark_link() | Displays the edit bookmark link. |
wp-includes/link-template.php:get_edit_term_link() | Retrieves the URL for editing a given term. |
wp-includes/http.php:get_allowed_http_origins() | Retrieve list of allowed HTTP origins. |
wp-includes/admin-bar.php:wp_admin_bar_site_menu() | Adds the “Site Name” menu. |
wp-includes/admin-bar.php:wp_admin_bar_my_sites_menu() | Adds the “My Sites/[Site Name]” menu and all submenus. |
wp-includes/admin-bar.php:wp_admin_bar_new_content_menu() | Adds “Add New” menu. |
wp-includes/admin-bar.php:wp_admin_bar_comments_menu() | Adds edit comments link with awaiting moderation count bubble. |
wp-includes/admin-bar.php:wp_admin_bar_appearance_menu() | Adds appearance submenu items to the “Site Name” menu. |
wp-includes/option.php:wp_user_settings() | Saves and restores user interface settings stored in a cookie. |
wp-includes/media.php:wp_plupload_default_settings() | Prints default Plupload arguments. |
wp-includes/media.php:wp_enqueue_media() | Enqueues all scripts, styles, settings, and templates necessary to use all media JS APIs. |
wp-includes/canonical.php:wp_redirect_admin_locations() | Redirects a variety of shorthand URLs to the admin. |
wp-includes/ms-functions.php:maybe_add_existing_user_to_blog() | Adds a new user to a blog by visiting /newbloguser/{key}/. |
wp-includes/script-loader.php:wp_default_scripts() | Registers all WordPress scripts. |
wp-includes/class-wp-editor.php:_WP_Editors::editor_js() | Print (output) the TinyMCE configuration and initialization scripts. |
wp-includes/media-template.php:wp_print_media_templates() | Prints the templates used in the media manager. |
Changelog
Version | Description |
---|---|
2.6.0 | Introduced. |