Get WordPress home url or front page url

In WordPress Home URL or site URL is mainly used to make a redirect to the home page by clicking on the logo or a special link on any position of the body or it is also used to link some static component. Now start WordPress get home URL

The basic way

The basic code to get home URL is home_url()
Example:


or the home URL can be fetched by the code get_bloginfo(‘url’)
Example:


Print s slash (/) on the last of Home Url

the code is used to print a slash (/) is home_url( '/' )
Example:


Redirect to https

To redirect https if it is not defined in base URL then have to pass another parameter ‘https’ on the code home URL
Example:


I hope the post WordPress get home URL helped you, please provide your comment to make the site better and more useful.

Thanks for Reading

Share The Post On -

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.