get_site_url 获取网站url地址

Posted in:
Update time:2020-10-27

函数描述

get_site_url() 模板标签获取指定站点的站点url,根据相应的协议返回 ‘siteurl’ 选项值,如果is_ssl()为true,返回 ‘https’,否则为 ‘http’ ,如果 $scheme 为 ‘http’ 或 ‘https’, is_ssl() 将被覆盖。

Usage

<?php get_site_url( $blog_id, $path, $scheme ); ?>

默认使用方法

<?php get_site_url(); ?> 

function parameter

parametersdata typeRequired or notdescriptivedefault value
$blog_idinteger (math.)clogged博客 ID当前博客ID
$pathstring (computer science)clogged相对于站点URL的地址not have
$schemestring (computer science)clogged指定给站点url的上下文方案,当前可用的有: ‘http’, ‘https’, ‘login’, ‘login_post’, ‘admin’ 或 ‘relative’.null

return value

(string) 添加有可选后缀路径的站点url

Filter

apply_filters( 'site_url', $url, $path, $orig_scheme, $blog_id );

usage example

<?php echo get_site_url(); ?>

返回完整的URL

http://www.example.com

We offer WordPress Themes and Plugins Custom Development Services

This site has long undertaken WordPress themes, plugins, WooCommerce-based store mall development business. We have 10 years of experience in WordPress development, if you want to Developing Websites with WordPress, please contact WeChat: iwillhappy1314 or email: amos@wpcio.com for inquiries.

发表回复

Your email address will not be published. 必填项已用 * 标注

*