Home_url () (Get home link)
Ome_url () function is used to get the homepage link of WordPress.
Usage
Home_url ($path, $scheme);
Parameters
$path
(optional) The content appended to the front page link is a relative link.
Default value: None
$scheme
(string) (optional) Link protocol that supports only "http", "https" and "relative".
Default value: null
return value
(string) returns the URL of the first page plus $path parameters.
Example
echo Home_url ()//output: http://www.example.com
echo home_url ('/');/output: http://www.example.com/
echo Home_url ('/', ' https ');/output: https://www.example.com/
echo home_url (' example ', ' relative ');/output:/example
Other
This function is located at: wp-includes/link-template.php
Site_url () (Get site link)
the Site_url () function is used to get WordPress site links.
Usage
Site_url ($path, $scheme);
Parameters
$path
(optional) The content appended after the link.
Default value: None
$scheme
(string) (optional) Link protocol that allows only "http", "https", "Login", "admin", and "relative".
Default value: null
return value
(string) returns the site link plus $path parameters.
Example
echo site_url ()//output: http://www.example.com or http://www.example.com/wordpress
echo site_url ('/secrets/', ' HTTPS ');//output: https://www.example.com/secrets/or https://www.example.com/wordpress/secrets/
Other
This function is located at: wp-includes/link-template.php