force_ssl_admin( string|bool $force = null )

Whether to force SSL used for the Administration Screens.


Description Description


Parameters Parameters

$force

(string|bool) (Optional) Whether to force SSL in admin screens.

Default value: null


Top ↑

Return Return

(bool) True if forced, false if not forced.


Top ↑

Source Source

File: wp-includes/functions.php

function force_ssl_admin( $force = null ) {
	static $forced = false;

	if ( ! is_null( $force ) ) {
		$old_forced = $forced;
		$forced     = $force;
		return $old_forced;
	}

	return $forced;
}

Top ↑

Changelog Changelog

Changelog
Version Description
2.6.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

  1. Skip to note 2 content
    Contributed by Codex

    Changing the Return Value

    <?php
    force_ssl_admin(true);
    if ( force_ssl_admin() ) {
      echo 'Administration should be performed over SSL';
    } else {
      echo 'This code will never execute';
    }
    force_ssl_admin(false);
    if ( force_ssl_admin() ) {
      echo 'This code will never execute';
    } else {
      echo 'Administration should NOT be performed over SSL';
    }
    ?> 
    

You must log in before being able to contribute a note or feedback.