Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the PHP function used to get the home page and site links in WordPress

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article is about what the PHP function used to get the home page and site links in WordPress is. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Home_url () (get the home page link)

The ome_url () function is used to get the link to the home page of WordPress.

Usage

Home_url ($path, $scheme)

Parameters.

$path

(string) (optional) the content appended after the home link is a relative link.

Default value: None

$scheme

(string) (optional) Link protocol, which only supports "http", "https" and "relative".

Default value: null

Return value

(string) returns the home page URL plus the $path parameter.

Examples

Echo home_url (); / / output: http://www.example.comecho 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 links)

The site_url () function is used to get a link to the site of WordPress.

Usage

Site_url ($path, $scheme)

Parameters.

$path

(string) (optional) what is appended after the link.

Default value: None

$scheme

(string) (optional) Link protocol, only "http", "https", "login", "admin" and "relative" are allowed.

Default value: null

Return value

(string) return the site link with the $path parameter.

Examples

Echo site_url (); / / output: http://www.example.com or http://www.example.com/wordpressecho site_url ('/ secrets/', 'https'); / / output: https://www.example.com/secrets/ or https://www.example.com/wordpress/secrets/ thank you for reading! About "what is the PHP function used to get the home page and site links in WordPress?" this article ends here. I hope the above content can be of some help to you, so that you can learn more knowledge. If you think the article is good, you can share it out for more people to see it!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report