WordPress.org

Ready to get started?Download WordPress

Codex

Function Reference/force ssl admin

Contents

Description

Determine whether the administration panel should be viewed over SSL. This function relies on the FORCE_SSL_ADMIN constant that is set in the wp-config.php file if you're using your site over SSL.

The force parameter will change the return value of this function until it is reset.

Usage

 <?php force_ssl_admin(); ?> 

Default Usage

 <?php if ( force_ssl_admin() ) { echo 'Administration should be performed over SSL'; } ?> 

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';
}
?> 

Resetting the Return Value

 <?php force_ssl_admin(FORCE_SSL_ADMIN); ?> 

Parameters

$force
(boolean) (optional) If provided, the return value will be reset to this value on the next call.
Default: None

Returns

(boolean) 
True if administration should be performed over SSL, false otherwise

Changelog

Since: Wordpress 2.6.0

Source Code

force_ssl_admin() is located in wp-includes/functions.php.

Related

force_ssl_login()

force_ssl_content()

Administration_Over_SSL

See also index of Function Reference and index of Template Tags.