Last active
April 13, 2020 06:11
-
-
Save marcwiest/5e812df4d0332fe204e3f6abee4759c5 to your computer and use it in GitHub Desktop.
Extended WP `is_ssl()` function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| if (! function_exists('is_ssl')) : | |
| /** | |
| * Check if SSL is enabled. | |
| */ | |
| function is_ssl() | |
| { | |
| if (is_ssl()) { | |
| return true; | |
| } | |
| elseif (0 === stripos(get_option('siteurl'), 'https://')) { | |
| return true; | |
| } | |
| elseif (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && 'https' == $_SERVER['HTTP_X_FORWARDED_PROTO']) { | |
| return true; | |
| } | |
| return false; | |
| } | |
| endif; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment