wp_is_using_https()
云策文档标注
概述
wp_is_using_https() 函数用于检查网站是否使用 HTTPS,基于主页和站点 URL 的 HTTPS 状态进行判断。
关键要点
- 函数返回布尔值:true 表示使用 HTTPS,false 表示未使用。
- 内部逻辑依赖于 wp_is_home_url_using_https() 和 wp_is_site_url_using_https() 函数。
- 相关函数包括 wp_is_home_url_using_https() 和 wp_is_site_url_using_https(),用于检查特定 URL 的 HTTPS 状态。
- 在 WordPress 5.7.0 版本中引入。
代码示例
function wp_is_using_https() {
if ( ! wp_is_home_url_using_https() ) {
return false;
}
return wp_is_site_url_using_https();
}
原文内容
Checks whether the website is using HTTPS.
Description
This is based on whether both the home and site URL are using HTTPS.
See also
Source
function wp_is_using_https() {
if ( ! wp_is_home_url_using_https() ) {
return false;
}
return wp_is_site_url_using_https();
}
Changelog
| Version | Description |
|---|---|
| 5.7.0 | Introduced. |