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