is_ssl(): bool
- Since
- 2.6.0, 4.6.0
- Source
wp-includes/load.php:1630
Compatibility
- WordPress
- since 4.6.0
- PHP
- 7.4–8.6-dev
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0), and compiles on PHP 7.4 through 8.6-dev.
Return value
bool- True if SSL, otherwise false.
Performance profile
How much work a call to is_ssl() does, and what it touches: the algorithmic scaling, the Zend instruction count per call across PHP versions, the hooks it hands control to, and the core code that calls it. Measured from the compiled opcodes, not a stopwatch, so every number is identical on any machine running the same PHP version, and every function in core is ranked by cost.
- Cost class
- Trivial
- Scaling
- Constant
- Instructions
- 7–16
- Plugin surface
- None
- Called by
- 26
Touches nothing outside its own arguments.
No loop in the body: the same number of instructions runs whatever you pass in.
Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 27.
Nothing here hands control to plugin code.
26 places in core call this, so the cost is paid more often than your own code shows.
What one call costs · 2 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost is_ssl() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
!isset($value) | 7–12 | none |
isset($value) | 11–16 | strtolower() |
Across PHP versions
Compiles the same on PHP 7.4, 8.1, 8.2, 8.3, 8.4, 8.5 and 8.6-dev: 27 instructions, 7–16 executed per call, 5 branches. The work does not change between versions.
An instruction is not a fixed amount of time, so a matching count is not necessarily the same speed; what it rules out is a difference in the work itself.
Used by · 26
- WP_Customize_Manager::get_allowed_urls()Gets URLs allowed to be previewed.
- WP_Debug_Data::get_wp_core()Gets the WordPress core section of the debug data.
- WP_Recovery_Mode::redirect_protected()Redirects the current request to allow recovering multiple errors in one go.
- WP_Recovery_Mode_Cookie_Service::set_cookie()Sets the recovery mode cookie.
- WP_Site_Health::get_test_https_status()Tests if the site is serving content over HTTPS.
- auth_redirect()Checks if a user is logged in, if not it redirects them to the login page.
- filter_SSL()Formats a URL to use https.
- get_home_url()Retrieves the URL for a given site where the front end is accessible.
- get_rest_url()Retrieves the URL to a REST endpoint on a site.
- ms_load_current_site_and_network()Identifies the network and site of a requested domain and path and populates the corresponding network and site global objects as part of the multisite bootstrap process.
- network_home_url()Retrieves the home URL for the current network.
- redirect_canonical()Redirects incoming links to the proper URL based on the site url.
Show all 26
- render_block_core_loginout()Renders the `core/loginout` block on server.
- set_url_scheme()Sets the scheme for a URL.
- wp_admin_bar_customize_menu()Adds the "Customize" link to the Toolbar.
- wp_ajax_parse_embed()Applies [embed] Ajax handlers to a string.
- wp_auth_check_html()Outputs the HTML that shows the wp-login dialog when the user is no longer logged in.
- wp_calculate_image_srcset()A helper function to calculate the image sources to include in a 'srcset' attribute.
- wp_dashboard_browser_nag()Displays the browser update nag.
- wp_get_attachment_url()Retrieves the URL for an attachment.
- wp_guess_url()Guesses the URL for the site.
- wp_is_application_passwords_supported()Checks if Application Passwords is supported.
- wp_login_form()Provides a simple login form for use anywhere within WordPress.
- wp_parse_auth_cookie()Parses a cookie into its components.
- wp_set_auth_cookie()Sets the authentication cookies based on user ID.
- wp_signon()Authenticates and logs a user in with 'remember' capability.
Source code
function is_ssl() { if ( isset( $_SERVER['HTTPS'] ) ) { if ( 'on' === strtolower( $_SERVER['HTTPS'] ) ) { return true; } if ( '1' === (string) $_SERVER['HTTPS'] ) { return true; } } elseif ( isset( $_SERVER['SERVER_PORT'] ) && ( '443' === (string) $_SERVER['SERVER_PORT'] ) ) { return true; } return false;}Changelog
Introduced in 2.6.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 6.7.7 tag, from
src/wp-includes/load.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.