• 赤色のリンクは、まだ日本語Codexに存在しないページ・画像です。英語版と併せてご覧ください。(詳細

このWikiはいつでも誰でも編集できます

関数リファレンス/is ssl

提供: WordPress Codex 日本語版
< 関数リファレンス
2018年3月3日 (土) 20:39時点におけるGblsm (トーク | 投稿記録)による版 (en:Function Reference/is_ssl 00:40, 31 December 2016 Robertcalise 版を流し込み。)

(差分) ← 古い版 | 最新版 (差分) | 新しい版 → (差分)
移動先: 案内検索

Description

Checks if SSL is being used.

Usage

<?php is_ssl() ?>

Parameters

This tag has no parameters.

Return Values

(bool) 
Returns true or false

Examples

<?php 
  if (is_ssl()) {
    //action to take for page using SSL
  }
?>

Notes

Returns true if the page is using SSL (checks if HTTPS or on Port 443).

NB: this won't work for websites behind some load balancers, especially Network Solutions hosted websites. To bodgy up a fix, save this gist into the plugins folder and enable it. For details, read WordPress is_ssl() doesn’t work behind some load balancers.

Websites behind load balancers or reverse proxies that support HTTP_X_FORWARDED_PROTO can be fixed by adding the following code to the wp-config.php file, above the require_once call:

if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
    $_SERVER['HTTPS'] = 'on';

Change Log

Since: 2.6.0

Source File

is_ssl() is located in 構文エラー: "trunk" は認識できません/src/wp-includes/load.php wp-includes/load.php. For versions of WordPress prior to 4.6.0, it was located in 構文エラー: "tags" は認識できません/src/wp-includes/functions.php wp-includes/functions.php.

Related

WordPress Code Reference : is_ssl()

force_ssl_admin()

force_ssl_content()

Administration_Over_SSL


関数リファレンステンプレートタグ目次もご覧ください。


最新英語版: WordPress Codex » Function Reference/is_ssl最新版との差分