函数文档

force_ssl_login()

💡 云策文档标注

概述

force_ssl_login() 是一个已弃用的 WordPress 函数,用于控制是否强制 SSL 登录。自 4.4.0 版本起,建议使用 force_ssl_admin() 替代。

关键要点

  • 该函数已弃用,自 WordPress 4.4.0 起应使用 force_ssl_admin()。
  • 函数接受一个可选参数 $force,类型为字符串或布尔值,用于指定是否强制 SSL 登录,默认值为 null。
  • 返回值为布尔类型,true 表示强制 SSL 登录,false 表示不强制。
  • 函数内部调用 _deprecated_function() 标记弃用,并重定向到 force_ssl_admin()。

注意事项

在开发中,应避免使用此函数,转而使用 force_ssl_admin() 以确保代码兼容性和安全性。


📄 原文内容

Whether SSL login should be forced.

Description

See also

Parameters

$forcestring|booloptional
Optional Whether to force SSL login.

Default:null

Return

bool True if forced, false if not forced.

Source

function force_ssl_login( $force = null ) {
	_deprecated_function( __FUNCTION__, '4.4.0', 'force_ssl_admin()' );
	return force_ssl_admin( $force );
}

Changelog

Version Description
4.4.0 Deprecated. Use force_ssl_admin()
2.6.0 Introduced.