home_url( string $path = '', string|null $scheme = null )
Retrieves the URL for the current site where the front end is accessible.
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
- $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
(string) Home URL link with optional path appended.
Source
File: wp-includes/link-template.php
function home_url( $path = '', $scheme = null ) { return get_home_url( null, $path, $scheme ); }
Related
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 | Description |
---|---|
wp-includes/https-detection.php: wp_update_https_detection_errors() | Runs a remote HTTPS request to detect whether HTTPS supported, and stores potential errors. |
wp-includes/https-detection.php: wp_is_home_url_using_https() | Checks whether the current site URL is using HTTPS. |
wp-includes/https-migration.php: wp_should_replace_insecure_home_url() | Checks whether WordPress should replace old HTTP URLs to the site with their HTTPS counterpart. |
wp-includes/https-migration.php: wp_replace_insecure_home_url() | Replaces insecure HTTP URLs to the site in the given content, if configured to do so. |
wp-includes/sitemaps/class-wp-sitemaps-provider.php: WP_Sitemaps_Provider::get_sitemap_url() | Gets the URL of a sitemap entry. |
wp-includes/sitemaps/class-wp-sitemaps-index.php: WP_Sitemaps_Index::get_index_url() | Builds the URL for the sitemap index. |
wp-includes/sitemaps/class-wp-sitemaps-renderer.php: WP_Sitemaps_Renderer::get_sitemap_index_stylesheet_url() | Gets the URL for the sitemap index stylesheet. |
wp-includes/sitemaps/class-wp-sitemaps-renderer.php: WP_Sitemaps_Renderer::get_sitemap_stylesheet_url() | Gets the URL for the sitemap stylesheet. |
wp-includes/sitemaps/providers/class-wp-sitemaps-posts.php: WP_Sitemaps_Posts::get_url_list() | Gets a URL list for a post type sitemap. |
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-includes/formatting.php: wp_rel_callback() | Callback to add a rel attribute to HTML A element. |
wp-includes/feed.php: get_self_link() | Returns the link for the currently displayed feed. |
wp-includes/class-wp-recovery-mode.php: WP_Recovery_Mode::handle_exit_recovery_mode() | Handles a request to exit Recovery Mode. |
wp-includes/class-wp-recovery-mode-email-service.php: WP_Recovery_Mode_Email_Service::send_recovery_mode_email() | Sends the Recovery Mode email to the site admin email address. |
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/privacy-tools.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() | Attempts 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() | Expands 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 unless the theme supports removing the link on the home page. |
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/plugin-install.php: plugins_api() | Retrieves plugin installer pages from the WordPress.org Plugins API. |
wp-admin/includes/dashboard.php: wp_check_browser_version() | Checks 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/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/includes/class-custom-image-header.php: Custom_Image_Header::step_1() | Display first step of custom header image page. |
wp-admin/includes/class-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() | Displays or retrieves the HTML list of categories. |
wp-includes/theme.php: _wp_customize_loader_settings() | Adds settings for the customize-loader script. |
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() | Parses the request to find the 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() | Checks for available updates to plugins based on the latest versions hosted on WordPress.org. |
wp-includes/update.php: wp_update_themes() | Checks for available updates to themes based on the latest versions hosted on WordPress.org. |
wp-includes/http.php: get_allowed_http_origins() | Retrieve list of allowed HTTP origins. |
wp-includes/class-wp-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/user.php: wp_update_user() | Update a user in the database. |
wp-includes/nav-menu-template.php: _wp_menu_item_classes_by_context() | Adds 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: wp_redirect_admin_locations() | Redirects a variety of shorthand URLs to the admin. |
wp-includes/canonical.php: redirect_canonical() | Redirects incoming links to the proper URL based on the site url. |
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. |
Changelog
Version | Description |
---|---|
3.0.0 | Introduced. |
© 2003–2021 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/home_url