force_ssl_admin() WordPress Function

The force_ssl_admin() function is used to force SSL on the WordPress admin interface. This is useful for sites that are served over SSL, but don't have SSL enabled for the WordPress admin.

force_ssl_admin( string|bool $force = null ) #

Whether to force SSL used for the Administration Screens.


Parameters

$force

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

Default value: null


Top ↑

Return

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


Top ↑

More Information

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.


Top ↑

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
VersionDescription
2.6.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More