Title: home_url
Published: April 25, 2014
Last modified: February 24, 2026

---

# home_url( string $path, string|null $scheme = null ): string

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/home_url/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/functions/home_url/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/home_url/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/home_url/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/home_url/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/home_url/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/functions/home_url/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/functions/home_url/?output_format=md#wp--skip-link--target)

Retrieves the URL for the current site where the front end is accessible.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/home_url/?output_format=md#description)󠁿

Returns the ‘home’ option with the appropriate protocol. The protocol will be ‘https’
if [is_ssl()](https://developer.wordpress.org/reference/functions/is_ssl/) evaluates
to true; otherwise, it will be the same as the ‘home’ option.
If `$scheme` is ‘http’
or ‘https’, [is_ssl()](https://developer.wordpress.org/reference/functions/is_ssl/)
is overridden.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/home_url/?output_format=md#parameters)󠁿

 `$path`stringoptional

Path relative to the home URL. Default empty.

`$scheme`string|nulloptional

Scheme to give the home URL context. Accepts `'http'`, `'https'`, `'relative'`, `'
rest'`, or null.

Default:`null`

## 󠀁[Return](https://developer.wordpress.org/reference/functions/home_url/?output_format=md#return)󠁿

 string Home URL link with optional path appended.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/home_url/?output_format=md#source)󠁿

    ```php
    function home_url( $path = '', $scheme = null ) {
    	return get_home_url( null, $path, $scheme );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/link-template.php#L3441)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/link-template.php#L3441-L3443)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/home_url/?output_format=md#related)󠁿

| Uses | Description | 
| [get_home_url()](https://developer.wordpress.org/reference/functions/get_home_url/)`wp-includes/link-template.php` |

Retrieves the URL for a given site where the front end is accessible.

  |

| Used by | Description | 
| [WP_URL_Pattern_Prefixer::get_default_contexts()](https://developer.wordpress.org/reference/classes/wp_url_pattern_prefixer/get_default_contexts/)`wp-includes/class-wp-url-pattern-prefixer.php` |

Returns the default contexts used by the class.

  | 
| [WP_Automatic_Updater::has_fatal_error()](https://developer.wordpress.org/reference/classes/wp_automatic_updater/has_fatal_error/)`wp-admin/includes/class-wp-automatic-updater.php` |

Performs a loopback request to check for potential fatal errors.

  | 
| [wp_get_https_detection_errors()](https://developer.wordpress.org/reference/functions/wp_get_https_detection_errors/)`wp-includes/https-detection.php` |

Runs a remote HTTPS request to detect whether HTTPS supported, and stores potential errors.

  | 
| [wp_internal_hosts()](https://developer.wordpress.org/reference/functions/wp_internal_hosts/)`wp-includes/link-template.php` |

Returns an array of URL hosts which are considered to be internal hosts.

  | 
| [WP_Site_Health::check_for_page_caching()](https://developer.wordpress.org/reference/classes/wp_site_health/check_for_page_caching/)`wp-admin/includes/class-wp-site-health.php` |

Checks if site has page cache enabled or not.

  | 
| [wp_is_home_url_using_https()](https://developer.wordpress.org/reference/functions/wp_is_home_url_using_https/)`wp-includes/https-detection.php` |

Checks whether the current site URL is using HTTPS.

  | 
| [wp_should_replace_insecure_home_url()](https://developer.wordpress.org/reference/functions/wp_should_replace_insecure_home_url/)`wp-includes/https-migration.php` |

Checks whether WordPress should replace old HTTP URLs to the site with their HTTPS counterpart.

  | 
| [wp_replace_insecure_home_url()](https://developer.wordpress.org/reference/functions/wp_replace_insecure_home_url/)`wp-includes/https-migration.php` |

Replaces insecure HTTP URLs to the site in the given content, if configured to do so.

  | 
| [WP_Sitemaps_Provider::get_sitemap_url()](https://developer.wordpress.org/reference/classes/wp_sitemaps_provider/get_sitemap_url/)`wp-includes/sitemaps/class-wp-sitemaps-provider.php` |

Gets the URL of a sitemap entry.

  | 
| [WP_Sitemaps_Index::get_index_url()](https://developer.wordpress.org/reference/classes/wp_sitemaps_index/get_index_url/)`wp-includes/sitemaps/class-wp-sitemaps-index.php` |

Builds the URL for the sitemap index.

  | 
| [WP_Sitemaps_Renderer::get_sitemap_index_stylesheet_url()](https://developer.wordpress.org/reference/classes/wp_sitemaps_renderer/get_sitemap_index_stylesheet_url/)`wp-includes/sitemaps/class-wp-sitemaps-renderer.php` |

Gets the URL for the sitemap index stylesheet.

  | 
| [WP_Sitemaps_Renderer::get_sitemap_stylesheet_url()](https://developer.wordpress.org/reference/classes/wp_sitemaps_renderer/get_sitemap_stylesheet_url/)`wp-includes/sitemaps/class-wp-sitemaps-renderer.php` |

Gets the URL for the sitemap stylesheet.

  | 
| [WP_Sitemaps_Posts::get_url_list()](https://developer.wordpress.org/reference/classes/wp_sitemaps_posts/get_url_list/)`wp-includes/sitemaps/providers/class-wp-sitemaps-posts.php` |

Gets a URL list for a post type sitemap.

  | 
| [WP_Automatic_Updater::send_plugin_theme_email()](https://developer.wordpress.org/reference/classes/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.

  | 
| [get_self_link()](https://developer.wordpress.org/reference/functions/get_self_link/)`wp-includes/feed.php` |

Returns the link for the currently displayed feed.

  | 
| [WP_Recovery_Mode::handle_exit_recovery_mode()](https://developer.wordpress.org/reference/classes/wp_recovery_mode/handle_exit_recovery_mode/)`wp-includes/class-wp-recovery-mode.php` |

Handles a request to exit Recovery Mode.

  | 
| [WP_Recovery_Mode_Email_Service::send_recovery_mode_email()](https://developer.wordpress.org/reference/classes/wp_recovery_mode_email_service/send_recovery_mode_email/)`wp-includes/class-wp-recovery-mode-email-service.php` |

Sends the Recovery Mode email to the site admin email address.

  | 
| [_wp_privacy_send_request_confirmation_notification()](https://developer.wordpress.org/reference/functions/_wp_privacy_send_request_confirmation_notification/)`wp-includes/user.php` |

Notifies the site administrator via email when a request is confirmed.

  | 
| [_wp_privacy_send_erasure_fulfillment_notification()](https://developer.wordpress.org/reference/functions/_wp_privacy_send_erasure_fulfillment_notification/)`wp-includes/user.php` |

Notifies the user when their erasure request is fulfilled.

  | 
| [wp_send_user_request()](https://developer.wordpress.org/reference/functions/wp_send_user_request/)`wp-includes/user.php` |

Send a confirmation request email to confirm an action.

  | 
| [wp_privacy_send_personal_data_export_email()](https://developer.wordpress.org/reference/functions/wp_privacy_send_personal_data_export_email/)`wp-admin/includes/privacy-tools.php` |

Send an email to the user with a link to the personal data export file

  | 
| [wp_site_admin_email_change_notification()](https://developer.wordpress.org/reference/functions/wp_site_admin_email_change_notification/)`wp-includes/functions.php` |

Sends an email to the old site admin email address when the site admin email address changes.

  | 
| [wp_network_admin_email_change_notification()](https://developer.wordpress.org/reference/functions/wp_network_admin_email_change_notification/)`wp-includes/ms-functions.php` |

Sends an email to the old network admin email address when the network admin email address changes.

  | 
| [wp_edit_theme_plugin_file()](https://developer.wordpress.org/reference/functions/wp_edit_theme_plugin_file/)`wp-admin/includes/file.php` |

Attempts to edit a file for a theme or plugin.

  | 
| [WP_Community_Events::get_events()](https://developer.wordpress.org/reference/classes/wp_community_events/get_events/)`wp-admin/includes/class-wp-community-events.php` |

Gets data about events near a particular location.

  | 
| [WP_Customize_Manager::is_cross_domain()](https://developer.wordpress.org/reference/classes/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_Customize_Manager::get_allowed_urls()](https://developer.wordpress.org/reference/classes/wp_customize_manager/get_allowed_urls/)`wp-includes/class-wp-customize-manager.php` |

Gets URLs allowed to be previewed.

  | 
| [get_theme_starter_content()](https://developer.wordpress.org/reference/functions/get_theme_starter_content/)`wp-includes/theme.php` |

Expands a theme’s starter content configuration using core-provided data.

  | 
| [the_embed_site_title()](https://developer.wordpress.org/reference/functions/the_embed_site_title/)`wp-includes/embed.php` |

Prints the necessary markup for the site title in an embed template.

  | 
| [get_custom_logo()](https://developer.wordpress.org/reference/functions/get_custom_logo/)`wp-includes/general-template.php` |

Returns a custom logo, linked to home unless the theme supports removing the link on the home page.

  | 
| [get_post_embed_url()](https://developer.wordpress.org/reference/functions/get_post_embed_url/)`wp-includes/embed.php` |

Retrieves the URL to embed a specific post in an iframe.

  | 
| [WP_Customize_Manager::get_preview_url()](https://developer.wordpress.org/reference/classes/wp_customize_manager/get_preview_url/)`wp-includes/class-wp-customize-manager.php` |

Gets the initial URL to be previewed.

  | 
| [WP_Customize_Manager::get_return_url()](https://developer.wordpress.org/reference/classes/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()](https://developer.wordpress.org/reference/classes/wp_customize_manager/customize_pane_settings/)`wp-includes/class-wp-customize-manager.php` |

Prints JavaScript settings for parent window.

  | 
| [WP_Customize_Manager::set_preview_url()](https://developer.wordpress.org/reference/classes/wp_customize_manager/set_preview_url/)`wp-includes/class-wp-customize-manager.php` |

Sets the initial URL to be previewed.

  | 
| [WP_REST_Server::get_index()](https://developer.wordpress.org/reference/classes/wp_rest_server/get_index/)`wp-includes/rest-api/class-wp-rest-server.php` |

Retrieves the site index.

  | 
| [WP_Customize_Nav_Menus::search_available_items_query()](https://developer.wordpress.org/reference/classes/wp_customize_nav_menus/search_available_items_query/)`wp-includes/class-wp-customize-nav-menus.php` |

Performs post queries for available-item searching.

  | 
| [WP_Customize_Nav_Menus::load_available_items_query()](https://developer.wordpress.org/reference/classes/wp_customize_nav_menus/load_available_items_query/)`wp-includes/class-wp-customize-nav-menus.php` |

Performs the post_type and taxonomy queries for loading available menu items.

  | 
| [login_footer()](https://developer.wordpress.org/reference/functions/login_footer/)`wp-login.php` |

Outputs the footer for the login page.

  | 
| [confirm_another_blog_signup()](https://developer.wordpress.org/reference/functions/confirm_another_blog_signup/)`wp-signup.php` |

Shows a message confirming that the new site has been created.

  | 
| [WP_Automatic_Updater::send_email()](https://developer.wordpress.org/reference/classes/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_Automatic_Updater::send_debug_email()](https://developer.wordpress.org/reference/classes/wp_automatic_updater/send_debug_email/)`wp-admin/includes/class-wp-automatic-updater.php` |

Prepares and sends an email of a full log of background update results, useful for debugging and geekery.

  | 
| [themes_api()](https://developer.wordpress.org/reference/functions/themes_api/)`wp-admin/includes/theme.php` |

Retrieves theme installer pages from the WordPress.org Themes API.

  | 
| [update_option_new_admin_email()](https://developer.wordpress.org/reference/functions/update_option_new_admin_email/)`wp-admin/includes/misc.php` |

Sends a confirmation request email when a change of site admin email address is attempted.

  | 
| [send_confirmation_on_profile_email()](https://developer.wordpress.org/reference/functions/send_confirmation_on_profile_email/)`wp-includes/user.php` |

Sends a confirmation request email when a change of user email address is attempted.

  | 
| [wp_check_browser_version()](https://developer.wordpress.org/reference/functions/wp_check_browser_version/)`wp-admin/includes/dashboard.php` |

Checks if the user needs a browser update.

  | 
| [plugins_api()](https://developer.wordpress.org/reference/functions/plugins_api/)`wp-admin/includes/plugin-install.php` |

Retrieves plugin installer pages from the WordPress.org Plugins API.

  | 
| [wp_nav_menu_item_post_type_meta_box()](https://developer.wordpress.org/reference/functions/wp_nav_menu_item_post_type_meta_box/)`wp-admin/includes/nav-menu.php` |

Displays a meta box for a post type menu item.

  | 
| [wp_get_popular_importers()](https://developer.wordpress.org/reference/functions/wp_get_popular_importers/)`wp-admin/includes/import.php` |

Returns a list from WordPress.org of popular importer plugins.

  | 
| [admin_created_user_email()](https://developer.wordpress.org/reference/functions/admin_created_user_email/)`wp-admin/includes/user.php` |  | 
| [wp_credits()](https://developer.wordpress.org/reference/functions/wp_credits/)`wp-admin/includes/credits.php` |

Retrieves the contributor credits.

  | 
| [Custom_Image_Header::step_1()](https://developer.wordpress.org/reference/classes/custom_image_header/step_1/)`wp-admin/includes/class-custom-image-header.php` |

Displays first step of custom header image page.

  | 
| [Custom_Background::admin_page()](https://developer.wordpress.org/reference/classes/custom_background/admin_page/)`wp-admin/includes/class-custom-background.php` |

Displays the custom background page.

  | 
| [WP_Customize_Manager::customize_preview_settings()](https://developer.wordpress.org/reference/classes/wp_customize_manager/customize_preview_settings/)`wp-includes/class-wp-customize-manager.php` |

Prints JavaScript settings for preview frame.

  | 
| [wp_list_categories()](https://developer.wordpress.org/reference/functions/wp_list_categories/)`wp-includes/category-template.php` |

Displays or retrieves the HTML list of categories.

  | 
| [wp_customize_support_script()](https://developer.wordpress.org/reference/functions/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()](https://developer.wordpress.org/reference/functions/_wp_customize_loader_settings/)`wp-includes/theme.php` |

Adds settings for the customize-loader script.

  | 
| [wp_validate_redirect()](https://developer.wordpress.org/reference/functions/wp_validate_redirect/)`wp-includes/pluggable.php` |

Validates a URL for use in a redirect.

  | 
| [wp_get_archives()](https://developer.wordpress.org/reference/functions/wp_get_archives/)`wp-includes/general-template.php` |

Displays archive links based on type and format.

  | 
| [get_bloginfo()](https://developer.wordpress.org/reference/functions/get_bloginfo/)`wp-includes/general-template.php` |

Retrieves information about the current site.

  | 
| [get_search_form()](https://developer.wordpress.org/reference/functions/get_search_form/)`wp-includes/general-template.php` |

Displays search form.

  | 
| [wp_admin_bar_dashboard_view_site_menu()](https://developer.wordpress.org/reference/functions/wp_admin_bar_dashboard_view_site_menu/)`wp-includes/deprecated.php` |

Add the “Dashboard”/”Visit Site” menu.

  | 
| [WP::parse_request()](https://developer.wordpress.org/reference/classes/wp/parse_request/)`wp-includes/class-wp.php` |

Parses the request to find the correct WordPress query.

  | 
| [wp_get_referer()](https://developer.wordpress.org/reference/functions/wp_get_referer/)`wp-includes/functions.php` |

Retrieves referer from ‘_wp_http_referer’ or HTTP referer.

  | 
| [WP_Widget_RSS::widget()](https://developer.wordpress.org/reference/classes/wp_widget_rss/widget/)`wp-includes/widgets/class-wp-widget-rss.php` |

Outputs the content for the current RSS widget instance.

  | 
| [WP_Widget_Categories::widget()](https://developer.wordpress.org/reference/classes/wp_widget_categories/widget/)`wp-includes/widgets/class-wp-widget-categories.php` |

Outputs the content for the current Categories widget instance.

  | 
| [get_term_link()](https://developer.wordpress.org/reference/functions/get_term_link/)`wp-includes/taxonomy.php` |

Generates a permalink for a taxonomy term archive.

  | 
| [wp_get_shortlink()](https://developer.wordpress.org/reference/functions/wp_get_shortlink/)`wp-includes/link-template.php` |

Returns a shortlink for a post, page, attachment, or site.

  | 
| [network_home_url()](https://developer.wordpress.org/reference/functions/network_home_url/)`wp-includes/link-template.php` |

Retrieves the home URL for the current network.

  | 
| [get_pagenum_link()](https://developer.wordpress.org/reference/functions/get_pagenum_link/)`wp-includes/link-template.php` |

Retrieves the link for a page number.

  | 
| [get_post_type_archive_link()](https://developer.wordpress.org/reference/functions/get_post_type_archive_link/)`wp-includes/link-template.php` |

Retrieves the permalink for a post type archive.

  | 
| [get_term_feed_link()](https://developer.wordpress.org/reference/functions/get_term_feed_link/)`wp-includes/link-template.php` |

Retrieves the feed link for a term.

  | 
| [get_search_link()](https://developer.wordpress.org/reference/functions/get_search_link/)`wp-includes/link-template.php` |

Retrieves the permalink for a search.

  | 
| [get_month_link()](https://developer.wordpress.org/reference/functions/get_month_link/)`wp-includes/link-template.php` |

Retrieves the permalink for the month archives with year.

  | 
| [get_day_link()](https://developer.wordpress.org/reference/functions/get_day_link/)`wp-includes/link-template.php` |

Retrieves the permalink for the day archives with year and month.

  | 
| [get_feed_link()](https://developer.wordpress.org/reference/functions/get_feed_link/)`wp-includes/link-template.php` |

Retrieves the permalink for the feed type.

  | 
| [get_post_comments_feed_link()](https://developer.wordpress.org/reference/functions/get_post_comments_feed_link/)`wp-includes/link-template.php` |

Retrieves the permalink for the post comments feed.

  | 
| [get_author_feed_link()](https://developer.wordpress.org/reference/functions/get_author_feed_link/)`wp-includes/link-template.php` |

Retrieves the feed link for a given author.

  | 
| [get_permalink()](https://developer.wordpress.org/reference/functions/get_permalink/)`wp-includes/link-template.php` |

Retrieves the full permalink for the current post or post ID.

  | 
| [get_post_permalink()](https://developer.wordpress.org/reference/functions/get_post_permalink/)`wp-includes/link-template.php` |

Retrieves the permalink for a post of a custom post type.

  | 
| [get_page_link()](https://developer.wordpress.org/reference/functions/get_page_link/)`wp-includes/link-template.php` |

Retrieves the permalink for the current page or page ID.

  | 
| [_get_page_link()](https://developer.wordpress.org/reference/functions/_get_page_link/)`wp-includes/link-template.php` |

Retrieves the page permalink.

  | 
| [get_attachment_link()](https://developer.wordpress.org/reference/functions/get_attachment_link/)`wp-includes/link-template.php` |

Retrieves the permalink for an attachment.

  | 
| [get_year_link()](https://developer.wordpress.org/reference/functions/get_year_link/)`wp-includes/link-template.php` |

Retrieves the permalink for the year archives.

  | 
| [WP_Admin_Bar::initialize()](https://developer.wordpress.org/reference/classes/wp_admin_bar/initialize/)`wp-includes/class-wp-admin-bar.php` |

Initializes the admin bar.

  | 
| [wp_version_check()](https://developer.wordpress.org/reference/functions/wp_version_check/)`wp-includes/update.php` |

Checks WordPress version against the newest version.

  | 
| [wp_update_plugins()](https://developer.wordpress.org/reference/functions/wp_update_plugins/)`wp-includes/update.php` |

Checks for available updates to plugins based on the latest versions hosted on WordPress.org.

  | 
| [wp_update_themes()](https://developer.wordpress.org/reference/functions/wp_update_themes/)`wp-includes/update.php` |

Checks for available updates to themes based on the latest versions hosted on WordPress.org.

  | 
| [get_allowed_http_origins()](https://developer.wordpress.org/reference/functions/get_allowed_http_origins/)`wp-includes/http.php` |

Retrieves list of allowed HTTP origins.

  | 
| [WP_oEmbed::__construct()](https://developer.wordpress.org/reference/classes/wp_oembed/__construct/)`wp-includes/class-wp-oembed.php` |

Constructor.

  | 
| [wp_admin_bar_site_menu()](https://developer.wordpress.org/reference/functions/wp_admin_bar_site_menu/)`wp-includes/admin-bar.php` |

Adds the “Site Name” menu.

  | 
| [wp_admin_bar_my_sites_menu()](https://developer.wordpress.org/reference/functions/wp_admin_bar_my_sites_menu/)`wp-includes/admin-bar.php` |

Adds the “My Sites/[Site Name]” menu and all submenus.

  | 
| [wp_admin_bar_search_menu()](https://developer.wordpress.org/reference/functions/wp_admin_bar_search_menu/)`wp-includes/admin-bar.php` |

Adds search form.

  | 
| [wp_update_user()](https://developer.wordpress.org/reference/functions/wp_update_user/)`wp-includes/user.php` |

Updates a user in the database.

  | 
| [_wp_menu_item_classes_by_context()](https://developer.wordpress.org/reference/functions/_wp_menu_item_classes_by_context/)`wp-includes/nav-menu-template.php` |

Adds the class property classes for the current context, if applicable.

  | 
| [wp_page_menu()](https://developer.wordpress.org/reference/functions/wp_page_menu/)`wp-includes/post-template.php` |

Displays or retrieves a list of pages with an optional home link.

  | 
| [is_local_attachment()](https://developer.wordpress.org/reference/functions/is_local_attachment/)`wp-includes/post.php` |

Determines whether an attachment URI is local and really an attachment.

  | 
| [WP_Rewrite::mod_rewrite_rules()](https://developer.wordpress.org/reference/classes/wp_rewrite/mod_rewrite_rules/)`wp-includes/class-wp-rewrite.php` |

Retrieves mod_rewrite-formatted rewrite rules to write to .htaccess.

  | 
| [WP_Rewrite::iis7_url_rewrite_rules()](https://developer.wordpress.org/reference/classes/wp_rewrite/iis7_url_rewrite_rules/)`wp-includes/class-wp-rewrite.php` |

Retrieves IIS7 URL Rewrite formatted rewrite rules to write to web.config file.

  | 
| [WP_Rewrite::rewrite_rules()](https://developer.wordpress.org/reference/classes/wp_rewrite/rewrite_rules/)`wp-includes/class-wp-rewrite.php` |

Constructs rewrite matches and queries from permalink structure.

  | 
| [redirect_canonical()](https://developer.wordpress.org/reference/functions/redirect_canonical/)`wp-includes/canonical.php` |

Redirects incoming links to the proper URL based on the site url.

  | 
| [wp_redirect_admin_locations()](https://developer.wordpress.org/reference/functions/wp_redirect_admin_locations/)`wp-includes/canonical.php` |

Redirects a variety of shorthand URLs to the admin.

  | 
| [url_to_postid()](https://developer.wordpress.org/reference/functions/url_to_postid/)`wp-includes/rewrite.php` |

Examines a URL and try to determine the post ID it represents.

  | 
| [maybe_add_existing_user_to_blog()](https://developer.wordpress.org/reference/functions/maybe_add_existing_user_to_blog/)`wp-includes/ms-functions.php` |

Adds a new user to a blog by visiting /newbloguser/{key}/.

  | 
| [get_author_posts_url()](https://developer.wordpress.org/reference/functions/get_author_posts_url/)`wp-includes/author-template.php` |

Retrieves the URL to the author page for the user with the ID provided.

  | 
| [wp_xmlrpc_server::wp_getUsersBlogs()](https://developer.wordpress.org/reference/classes/wp_xmlrpc_server/wp_getusersblogs/)`wp-includes/class-wp-xmlrpc-server.php` |

Retrieves the blogs of the user.

  | 
| [weblog_ping()](https://developer.wordpress.org/reference/functions/weblog_ping/)`wp-includes/comment.php` |

Sends a pingback.

  | 
| [wp_set_comment_cookies()](https://developer.wordpress.org/reference/functions/wp_set_comment_cookies/)`wp-includes/comment.php` |

Sets the cookies used to store an unauthenticated commentator’s identity. Typically used to recall previous comments by this commentator that are still held in moderation.

  |

[Show 103 more](https://developer.wordpress.org/reference/functions/home_url/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/home_url/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/home_url/?output_format=md#changelog)󠁿

| Version | Description | 
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/functions/home_url/?output_format=md#user-contributed-notes)󠁿

 1.   [Skip to note 3 content](https://developer.wordpress.org/reference/functions/home_url/?output_format=md#comment-content-428)
 2.    [Codex](https://profiles.wordpress.org/codex/)  [  11 years ago  ](https://developer.wordpress.org/reference/functions/home_url/#comment-428)
 3.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fhome_url%2F%23comment-428)
     Vote results for this note: 8[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fhome_url%2F%23comment-428)
 4.  **Example**
 5.      ```php
         $url = home_url();
         echo $url;
         ```
     
 6.  Output: `http://www.example.com`
 7.  (Note the lack of a trailing slash)
 8.      ```php
         $url = home_url( '/' );
         echo $url;
         ```
     
 9.  Output: `http://www.example.com/`
 10.     ```php
         $url = home_url( $path = '/', $scheme = 'https' );
         echo $url;
         ```
     
 11. Output: `https://www.example.com/`
 12.     ```php
         $url = home_url( $path = 'example', $scheme = 'relative' );
         echo $url;
         ```
     
 13. Output: `/example`
 14.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fhome_url%2F%3Freplytocom%3D428%23feedback-editor-428)
 15.  [Skip to note 4 content](https://developer.wordpress.org/reference/functions/home_url/?output_format=md#comment-content-5369)
 16.   [Aurovrata Venet](https://profiles.wordpress.org/aurovrata/)  [  5 years ago  ](https://developer.wordpress.org/reference/functions/home_url/#comment-5369)
 17. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fhome_url%2F%23comment-5369)
     Vote results for this note: 2[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fhome_url%2F%23comment-5369)
 18. You can also add attributes at the end of the `$path` is need be…
 19.     ```php
         $url = esc_url(home_url( '/my-page?id=123'));
         echo $url;
     
         // https://your-domain/my-page?id=123
         ```
     
 20. but best to use [esc_url()](https://developer.wordpress.org/reference/functions/esc_url/)
     to ensure you get a clean url
 21.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fhome_url%2F%3Freplytocom%3D5369%23feedback-editor-5369)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fhome_url%2F)
before being able to contribute a note or feedback.