Skip to main content
edited body
Source Link
Rarst
  • 99.9k
  • 10
  • 161
  • 298

As posed in question the way to retrieve the current URL to the root of the site would be site_url()home_url() for site's front-end.

However there are multiple functions that deal with URLs to specific kinds of pages. It's not clear what you are linking to (post? page? archive?), but there are likely specific URL-forming function for it which should be used over constructing such URL "manually" from the root address.

As posed in question the way to retrieve the current URL to the root of the site would be site_url().

However there are multiple functions that deal with URLs to specific kinds of pages. It's not clear what you are linking to (post? page? archive?), but there are likely specific URL-forming function for it which should be used over constructing such URL "manually" from the root address.

As posed in question the way to retrieve the current URL to the root of the site would be home_url() for site's front-end.

However there are multiple functions that deal with URLs to specific kinds of pages. It's not clear what you are linking to (post? page? archive?), but there are likely specific URL-forming function for it which should be used over constructing such URL "manually" from the root address.

Source Link
Rarst
  • 99.9k
  • 10
  • 161
  • 298

As posed in question the way to retrieve the current URL to the root of the site would be site_url().

However there are multiple functions that deal with URLs to specific kinds of pages. It's not clear what you are linking to (post? page? archive?), but there are likely specific URL-forming function for it which should be used over constructing such URL "manually" from the root address.