force_ssl_content() WordPress Function

If you're running a website on WordPress and want to make sure your content is always served over a secure connection, you can use the force_ssl_content() function. This function will redirect all HTTP requests for your website to HTTPS, ensuring that your content is always encrypted.

force_ssl_content( bool $force = '' ) #

Determines whether to force SSL on content.


Parameters

$force

(bool)(Optional)

Default value: ''


Top ↑

Return

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


Top ↑

Source

File: wp-includes/ms-functions.php

function force_ssl_content( $force = '' ) {
	static $forced_content = false;

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

	return $forced_content;
}


Top ↑

Changelog

Changelog
VersionDescription
2.8.5Introduced.

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