wp_is_using_https()
Checks whether the website is using HTTPS.
This is based on whether both the home and site URL are using HTTPS.
1 time — 0.0034051 sec (very slow) | 50000 times — 7.82 sec (fast) | PHP 7.4.8, WP 5.7.1
No Hooks.
Return
true|false
. True if using HTTPS, false otherwise.
Usage
wp_is_using_https();
Examples
#1 A simple example of how to use
if ( wp_is_using_https() ) { // Site works over a secure HTTPS protocol } else { // The site works via the standard HTTP protocol }
Notes
Changelog
Since 5.7.0 | Introduced. |
wp_is_using_https() wp is using https code WP 6.7.1
function wp_is_using_https() { if ( ! wp_is_home_url_using_https() ) { return false; } return wp_is_site_url_using_https(); }