home_url( string $path = '', string|null $scheme = null )
Retrieves the URL for the current site where the front end is accessible.
Description #Description
Returns the ‘home’ option with the appropriate protocol. The protocol will be ‘https’ if is_ssl() evaluates to true; otherwise, it will be the same as the ‘home’ option. If $scheme
is ‘http’ or ‘https’, is_ssl() is overridden.
Parameters #Parameters
- $path
-
(string) (Optional) Path relative to the home URL.
Default value: ''
- $scheme
-
(string|null) (Optional) Scheme to give the home URL context. Accepts 'http', 'https', 'relative', 'rest', or null.
Default value: null
Return #Return
(string) Home URL link with optional path appended.
Source #Source
File: wp-includes/link-template.php
function home_url( $path = '', $scheme = null ) { return get_home_url( null, $path, $scheme ); }
Expand full source code Collapse full source code View on Trac
Changelog #Changelog
Version | Description |
---|---|
3.0.0 | Introduced. |
Related #Related
Uses #Uses
Uses | Description |
---|---|
wp-includes/link-template.php: get_home_url() |
Retrieves the URL for a given site where the front end is accessible. |
Used By #Used By
Used By | Description |
---|---|
wp-includes/blocks/categories.php: build_dropdown_script_block_core_categories() |
Generates the inline script for a categories dropdown field. |
wp-includes/user.php: _wp_privacy_send_request_confirmation_notification() |
Notify the site administrator via email when a request is confirmed. |
wp-includes/user.php: _wp_privacy_send_erasure_fulfillment_notification() |
Notify the user when their erasure request is fulfilled. |
wp-includes/user.php: wp_send_user_request() |
Send a confirmation request email to confirm an action. |
wp-admin/includes/file.php: wp_privacy_send_personal_data_export_email() |
Send an email to the user with a link to the personal data export file |
wp-includes/functions.php: wp_site_admin_email_change_notification() |
Send an email to the old site admin email address when the site admin email address changes. |
wp-includes/ms-functions.php: wp_network_admin_email_change_notification() |
Send an email to the old network admin email address when the network admin email address changes. |
wp-admin/includes/file.php: wp_edit_theme_plugin_file() |
Attempt to edit a file for a theme or plugin. |
wp-admin/includes/class-wp-community-events.php: WP_Community_Events::get_events() |
Gets data about events near a particular location. |
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-includes/class-wp-customize-manager.php: WP_Customize_Manager::get_allowed_urls() |
Get URLs allowed to be previewed. |
wp-includes/theme.php: get_theme_starter_content() |
Expand a theme’s starter content configuration using core-provided data. |
wp-includes/embed.php: the_embed_site_title() |
Prints the necessary markup for the site title in an embed template. |
wp-includes/general-template.php: get_custom_logo() |
Returns a custom logo, linked to home. |
wp-includes/embed.php: get_post_embed_url() |
Retrieves the URL to embed a specific post in an iframe. |
wp-includes/class-wp-customize-manager.php: WP_Customize_Manager::get_preview_url() |
Get the initial URL to be previewed. |
wp-includes/class-wp-customize-manager.php: WP_Customize_Manager::get_return_url() |
Get URL to link the user to when closing the Customizer. |
wp-includes/class-wp-customize-manager.php: WP_Customize_Manager::customize_pane_settings() |
Print JavaScript settings for parent window. |
wp-includes/class-wp-customize-manager.php: WP_Customize_Manager::set_preview_url() |
Set the initial URL to be previewed. |
wp-includes/rest-api/class-wp-rest-server.php: WP_REST_Server::get_index() |
Retrieves the site index. |
wp-includes/class-wp-customize-nav-menus.php: WP_Customize_Nav_Menus::search_available_items_query() |
Performs post queries for available-item searching. |
wp-includes/class-wp-customize-nav-menus.php: WP_Customize_Nav_Menus::load_available_items_query() |
Performs the post_type and taxonomy queries for loading available menu items. |
wp-login.php: login_footer() |
Outputs the footer for the login page. |
wp-signup.php: confirm_another_blog_signup() |
Confirm a new site signup. |
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: themes_api() |
Retrieves theme installer pages from the WordPress.org Themes API. |
wp-admin/includes/misc.php: update_option_new_admin_email() |
Send a confirmation request email when a change of site admin email address is attempted. |
wp-includes/user.php: send_confirmation_on_profile_email() |
Send a confirmation request email when a change of user email address is attempted. |
wp-admin/includes/dashboard.php: wp_check_browser_version() |
Check if the user needs a browser update |
wp-admin/includes/dashboard.php: wp_welcome_panel() |
Displays a welcome panel to introduce users to WordPress. |
wp-admin/includes/plugin-install.php: plugins_api() |
Retrieves plugin installer pages from the WordPress.org Plugins API. |
wp-admin/includes/nav-menu.php: wp_nav_menu_item_post_type_meta_box() |
Displays a meta box for a post type menu item. |
wp-admin/includes/import.php: wp_get_popular_importers() |
Returns a list from WordPress.org of popular importer plugins. |
wp-admin/includes/user.php: admin_created_user_email() | |
wp-admin/includes/credits.php: wp_credits() |
Retrieve the contributor credits. |
wp-admin/custom-header.php: Custom_Image_Header::step_1() |
Display first step of custom header image page. |
wp-admin/custom-background.php: Custom_Background::admin_page() |
Display the custom background page. |
wp-includes/class-wp-customize-manager.php: WP_Customize_Manager::customize_preview_settings() |
Print JavaScript settings for preview frame. |
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/category-template.php: wp_list_categories() |
Display or retrieve the HTML list of categories. |
wp-includes/theme.php: _wp_customize_loader_settings() |
Adds settings for the customize-loader script. |
wp-includes/formatting.php: wp_rel_nofollow_callback() |
Callback to add rel=nofollow string to HTML A element. |
wp-includes/pluggable.php: wp_validate_redirect() |
Validates a URL for use in a redirect. |
wp-includes/general-template.php: wp_get_archives() |
Display archive links based on type and format. |
wp-includes/general-template.php: get_bloginfo() |
Retrieves information about the current site. |
wp-includes/general-template.php: get_search_form() |
Display search form. |
wp-includes/deprecated.php: wp_admin_bar_dashboard_view_site_menu() |
Add the “Dashboard”/”Visit Site” menu. |
wp-includes/class-wp.php: WP::parse_request() |
Parse request to find correct WordPress query. |
wp-includes/functions.php: wp_get_referer() |
Retrieve referer from ‘_wp_http_referer’ or HTTP referer. |
wp-includes/widgets/class-wp-widget-rss.php: WP_Widget_RSS::widget() |
Outputs the content for the current RSS widget instance. |
wp-includes/widgets/class-wp-widget-categories.php: WP_Widget_Categories::widget() |
Outputs the content for the current Categories widget instance. |
wp-includes/taxonomy.php: get_term_link() |
Generate a permalink for a taxonomy term archive. |
wp-includes/link-template.php: wp_get_shortlink() |
Returns a shortlink for a post, page, attachment, or site. |
wp-includes/link-template.php: network_home_url() |
Retrieves the home URL for the current network. |
wp-includes/link-template.php: get_pagenum_link() |
Retrieves the link for a page number. |
wp-includes/link-template.php: get_post_type_archive_link() |
Retrieves the permalink for a post type archive. |
wp-includes/link-template.php: get_term_feed_link() |
Retrieves the feed link for a term. |
wp-includes/link-template.php: get_search_link() |
Retrieves the permalink for a search. |
wp-includes/link-template.php: get_month_link() |
Retrieves the permalink for the month archives with year. |
wp-includes/link-template.php: get_day_link() |
Retrieves the permalink for the day archives with year and month. |
wp-includes/link-template.php: get_feed_link() |
Retrieves the permalink for the feed type. |
wp-includes/link-template.php: get_post_comments_feed_link() |
Retrieves the permalink for the post comments feed. |
wp-includes/link-template.php: get_author_feed_link() |
Retrieves the feed link for a given author. |
wp-includes/link-template.php: get_permalink() |
Retrieves the full permalink for the current post or post ID. |
wp-includes/link-template.php: get_post_permalink() |
Retrieves the permalink for a post of a custom post type. |
wp-includes/link-template.php: get_page_link() |
Retrieves the permalink for the current page or page ID. |
wp-includes/link-template.php: _get_page_link() |
Retrieves the page permalink. |
wp-includes/link-template.php: get_attachment_link() |
Retrieves the permalink for an attachment. |
wp-includes/link-template.php: get_year_link() |
Retrieves the permalink for the year archives. |
wp-includes/class-wp-admin-bar.php: WP_Admin_Bar::initialize() | |
wp-includes/update.php: wp_version_check() |
Check WordPress version against the newest version. |
wp-includes/update.php: wp_update_plugins() |
Check plugin versions against the latest versions hosted on WordPress.org. |
wp-includes/update.php: wp_update_themes() |
Check theme versions against the latest versions hosted on WordPress.org. |
wp-includes/http.php: get_allowed_http_origins() |
Retrieve list of allowed HTTP origins. |
wp-includes/class-oembed.php: WP_oEmbed::__construct() |
Constructor. |
wp-includes/admin-bar.php: wp_admin_bar_site_menu() |
Add the “Site Name” menu. |
wp-includes/admin-bar.php: wp_admin_bar_my_sites_menu() |
Add the “My Sites/[Site Name]” menu and all submenus. |
wp-includes/admin-bar.php: wp_admin_bar_search_menu() |
Add search form. |
wp-includes/feed.php: self_link() |
Display the link for the currently displayed feed in a XSS safe way. |
wp-includes/user.php: wp_update_user() |
Update a user in the database. |
wp-includes/nav-menu-template.php: _wp_menu_item_classes_by_context() |
Add the class property classes for the current context, if applicable. |
wp-includes/post-template.php: wp_page_menu() |
Displays or retrieves a list of pages with an optional home link. |
wp-includes/post.php: is_local_attachment() |
Determines whether an attachment URI is local and really an attachment. |
wp-includes/class-wp-rewrite.php: WP_Rewrite::mod_rewrite_rules() |
Retrieves mod_rewrite-formatted rewrite rules to write to .htaccess. |
wp-includes/class-wp-rewrite.php: WP_Rewrite::iis7_url_rewrite_rules() |
Retrieves IIS7 URL Rewrite formatted rewrite rules to write to web.config file. |
wp-includes/class-wp-rewrite.php: WP_Rewrite::rewrite_rules() |
Constructs rewrite matches and queries from permalink structure. |
wp-includes/rewrite.php: url_to_postid() |
Examine a URL and try to determine the post ID it represents. |
wp-includes/canonical.php: redirect_canonical() |
Redirects incoming links to the proper URL based on the site url. |
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() |
Add a new user to a blog by visiting /newbloguser/{key}/. |
wp-includes/author-template.php: get_author_posts_url() |
Retrieve the URL to the author page for the user with the ID provided. |
wp-includes/class-wp-xmlrpc-server.php: wp_xmlrpc_server::wp_getUsersBlogs() |
Retrieve the blogs of the user. |
wp-includes/comment.php: weblog_ping() |
Send a pingback. |
wp-includes/comment.php: wp_set_comment_cookies() |
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. |
User Contributed Notes #User Contributed Notes
You must log in before being able to contribute a note or feedback.
Example
Output:
http://www.example.com
(Note the lack of a trailing slash)
Output:
http://www.example.com/
Output:
https://www.example.com/
Output:
/example