首页 WordPress函数大全 ms_load_current_site_and_network()

ms_load_current_site_and_network()

2020-05-02 / 2950阅 / 悠然

如何你看完本文还不知道如何使用该函数,可以联系我定制视频教程,50元/个函数,学不会全额退款

警报:此功能的访问被标记为私有。这意味着它不适合插件或主题开发人员使用,> string  $ domainstring  $ pathbool  $ subdomain  =  false  )

标识请求域和路径的网络和站点,并在多站点引导过程中填充相应的网络和站点全局对象。

描述

在4.6.0之前,这是ms-settings.php中的一个程序块。它包装到一个函数中,以方便单元测试。不应在核心之外使用。

通常,先查询站点然后声明其网络会更容易。在有限的情况下,我们可以或者必须首先找到网络。

如果找到网络和站点,则将返回真实响应,以便请求可以继续。

如果找不到网络或站点,则将返回false或URL字符串,以便显示错误或发生重定向。

参数

$domain

(string)
(Required)
The requested domain.

$path

(string)
(Required)
The requested path.

$subdomain

(bool)
(Optional)
Whether a subdomain (true) or subdirectory (false) configuration.

Default value: false

返回

(bool|string) True if bootstrap successfully populated $current_blog and $current_site. False if bootstrap could not be properly completed. Redirect URL if parts exist, but the request as a whole can not be fulfilled.

大家谈论
    我的见解