wp_get_update_https_url

函式
wp_get_update_https_url ( No parameters )
返回值
  • (string) URL to learn more about updating to HTTPS.
定義位置
相關方法
wp_get_direct_update_https_urlwp_get_update_php_urlwp_get_default_update_https_urlwp_get_update_datawp_get_default_update_php_url
引入
5.7.0
棄用
-

wp_get_update_https_url: 這個函式返回一個給定更新URL的HTTPS URL。它需要一個引數:更新URL。如果網站在HTTPS上執行,該函式返回HTTPS版本的URL。如果該網站沒有執行在HTTPS上,該函式返回原始的URL。

獲取URL以瞭解更多關於更新網站使用HTTPS的資訊。

這個URL可以通過指定環境變數`WP_UPDATE_HTTPS_URL`或者使用{@see ‘wp_update_https_url’}過濾器來覆蓋。提供一個空字串是不允許的,這將導致使用預設的URL。此外,URL連結到的頁面最好是用網站語言進行本地化。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function wp_get_update_https_url() {
$default_url = wp_get_default_update_https_url();
$update_url = $default_url;
if ( false !== getenv( 'WP_UPDATE_HTTPS_URL' ) ) {
$update_url = getenv( 'WP_UPDATE_HTTPS_URL' );
}
/**
* Filters the URL to learn more about updating the HTTPS version the site is running on.
*
* Providing an empty string is not allowed and will result in the default URL being used. Furthermore
* the page the URL links to should preferably be localized in the site language.
*
* @since 5.7.0
*
* @param string $update_url URL to learn more about updating HTTPS.
*/
$update_url = apply_filters( 'wp_update_https_url', $update_url );
if ( empty( $update_url ) ) {
$update_url = $default_url;
}
return $update_url;
}
function wp_get_update_https_url() { $default_url = wp_get_default_update_https_url(); $update_url = $default_url; if ( false !== getenv( 'WP_UPDATE_HTTPS_URL' ) ) { $update_url = getenv( 'WP_UPDATE_HTTPS_URL' ); } /** * Filters the URL to learn more about updating the HTTPS version the site is running on. * * Providing an empty string is not allowed and will result in the default URL being used. Furthermore * the page the URL links to should preferably be localized in the site language. * * @since 5.7.0 * * @param string $update_url URL to learn more about updating HTTPS. */ $update_url = apply_filters( 'wp_update_https_url', $update_url ); if ( empty( $update_url ) ) { $update_url = $default_url; } return $update_url; }
function wp_get_update_https_url() {
	$default_url = wp_get_default_update_https_url();

	$update_url = $default_url;
	if ( false !== getenv( 'WP_UPDATE_HTTPS_URL' ) ) {
		$update_url = getenv( 'WP_UPDATE_HTTPS_URL' );
	}

	/**
	 * Filters the URL to learn more about updating the HTTPS version the site is running on.
	 *
	 * Providing an empty string is not allowed and will result in the default URL being used. Furthermore
	 * the page the URL links to should preferably be localized in the site language.
	 *
	 * @since 5.7.0
	 *
	 * @param string $update_url URL to learn more about updating HTTPS.
	 */
	$update_url = apply_filters( 'wp_update_https_url', $update_url );
	if ( empty( $update_url ) ) {
		$update_url = $default_url;
	}

	return $update_url;
}

常見問題

FAQs
檢視更多 >