wp_replace_insecure_home_url
函数
wp_replace_insecure_home_url ( $content )
- 参数
-
-
(string)
$content
Content to replace URLs in.- Required: 是
-
(string)
- 返回值
-
- (string) Filtered content.
- 定义位置
-
-
wp-includes/https-migration.php
, line 51
-
wp-includes/https-migration.php
- 引入
- 5.7.0
- 弃用
- –
Replaces insecure HTTP URLs to the site in the given content, if configured to do so.
This function replaces all occurrences of the HTTP version of the site’s URL with its HTTPS counterpart, if
determined via {@see}.
function wp_replace_insecure_home_url( $content ) { if ( ! wp_should_replace_insecure_home_url() ) { return $content; } $https_url = home_url( '', 'https' ); $http_url = str_replace( 'https://', 'http://', $https_url ); // Also replace potentially escaped URL. $escaped_https_url = str_replace( '/', '/', $https_url ); $escaped_http_url = str_replace( '/', '/', $http_url ); return str_replace( array( $http_url, $escaped_http_url, ), array( $https_url, $escaped_https_url, ), $content ); }
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。