
什么是WordPress版本控制及最佳解决方案
wp_is_site_url_using_https ( No parameters )
wp_is_site_url_using_https: 这个函数用于检查网站的URL是否使用HTTPS。如果网站的URL使用了HTTPS,则返回真,否则返回假。
检查当前网站存储WordPress的URL是否使用了HTTPS。
这将检查WordPress应用文件(如wp-blog-header.php或wp-admin/文件夹)可被访问的URL。
function wp_is_site_url_using_https() { // Use direct option access for 'siteurl' and manually run the 'site_url' // filter because `site_url()` will adjust the scheme based on what the // current request is using. /** This filter is documented in wp-includes/link-template.php */ $site_url = apply_filters( 'site_url', get_option( 'siteurl' ), '', null, null ); return 'https' === wp_parse_url( $site_url, PHP_URL_SCHEME ); }