Retrieves the URL to the admin area for the current site.
Parameters
$path
stringoptional- Path relative to the admin URL.
Default:
''
$scheme
stringoptional- 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
function admin_url( $path = '', $scheme = 'admin' ) {
return get_admin_url( null, $path, $scheme );
}
Related
Uses | Description |
---|---|
get_admin_url()wp-includes/link-template.php | Retrieves the URL to the admin area for a given site. |
Used by | Description |
---|---|
WP_Plugin_Dependencies::check_plugin_dependencies_during_ajax()wp-includes/class-wp-plugin-dependencies.php | Checks plugin dependencies after a plugin is installed via AJAX. |
WP_Plugin_Dependencies::display_admin_notice_for_unmet_dependencies()wp-includes/class-wp-plugin-dependencies.php | Displays an admin notice if dependencies are not installed. |
WP_Widget_Media::get_l10n_defaults()wp-includes/widgets/class-wp-widget-media.php | Returns the default localized strings used by the widget. |
deactivated_plugins_notice()wp-admin/includes/plugin.php | Renders an admin notice when a plugin was deactivated during an update. |
WP_Privacy_Requests_Table::get_admin_url()wp-admin/includes/class-wp-privacy-requests-table.php | Normalizes 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 | Outputs the Actions column. |
WP_Privacy_Data_Removal_Requests_List_Table::column_next_steps()wp-admin/includes/class-wp-privacy-data-removal-requests-list-table.php | Outputs the 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. |
paused_themes_notice()wp-admin/includes/theme.php | Renders an admin notice in case some themes have been paused due to errors. |
paused_plugins_notice()wp-admin/includes/plugin.php | Renders an admin notice in case some plugins have been paused due to errors. |
validate_plugin_requirements()wp-admin/includes/plugin.php | Validates the plugin requirements for WordPress version and PHP version. |
wp_default_packages_inline_scripts()wp-includes/script-loader.php | Adds inline scripts required for the WordPress JavaScript packages. |
wp_load_press_this()wp-admin/press-this.php | |
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. |
network_step1()wp-admin/includes/network.php | Prints step 1 for Network installation process. |
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 | Performs an action following a single theme update. |
Plugin_Installer_Skin::after()wp-admin/includes/class-plugin-installer-skin.php | Performs an action following a plugin install. |
Theme_Installer_Skin::after()wp-admin/includes/class-theme-installer-skin.php | Performs an action following a single theme install. |
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_Themes_List_Table::no_items()wp-admin/includes/class-wp-themes-list-table.php | |
wp_prepare_revisions_for_js()wp-admin/includes/revision.php | Prepare revisions for JavaScript. |
update_core()wp-admin/includes/update-core.php | Upgrades the core of WordPress. |
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 | |
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_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_Nav_Menu_Widget::form()wp-includes/widgets/class-wp-nav-menu-widget.php | Outputs the settings form for the Navigation Menu widget. |
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. |
wp_redirect_admin_locations()wp-includes/canonical.php | Redirects a variety of shorthand URLs to the admin. |
wp_default_scripts()wp-includes/script-loader.php | Registers all WordPress 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. |
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
The presence of a leading slash in the path doesn’t affect the output, as it will be internally removed. Thus, both calls to
admin_url()
will yield the same result:Logout Users based on specific capabilities and role
Usage