钩子文档

domain_exists

💡 云策文档标注

概述

domain_exists 过滤器用于在 WordPress 多站点网络中检查站点名称是否已被占用,允许开发者自定义检查逻辑。

关键要点

  • 过滤器名称:domain_exists
  • 作用:过滤站点名称是否已存在的检查结果,可修改返回的站点 ID 或 null
  • 参数:$result(站点 ID 或 null)、$domain(域名)、$path(路径)、$network_id(网络 ID)
  • 相关函数:domain_exists() 用于检查站点名称是否已占用
  • 版本:自 WordPress 3.5.0 引入

📄 原文内容

Filters whether a site name is taken.

Description

The name is the site’s subdomain or the site’s subdirectory path depending on the network settings.

Parameters

$resultint|null
The site ID if the site name exists, null otherwise.
$domainstring
Domain to be checked.
$pathstring
Path to be checked.
$network_idint
Network ID. Only relevant on multi-network installations.

Source

return apply_filters( 'domain_exists', $result, $domain, $path, $network_id );

Changelog

Version Description
3.5.0 Introduced.