钩子文档

pre_wp_is_site_initialized

💡 云策文档标注

概述

pre_wp_is_site_initialized 是一个 WordPress 过滤器,用于在数据库访问前检查站点是否已初始化。开发者可以通过此过滤器自定义检查逻辑,返回非 null 值将直接短路函数。

关键要点

  • 过滤器名称:pre_wp_is_site_initialized
  • 作用:在 wp_is_site_initialized() 函数执行前,过滤站点初始化检查
  • 参数:$pre(默认 null,返回非 null 值将短路函数)、$site_id(站点 ID)
  • 相关函数:wp_is_site_initialized(),位于 wp-includes/ms-site.php
  • 引入版本:WordPress 5.1.0

📄 原文内容

Filters the check for whether a site is initialized before the database is accessed.

Description

Returning a non-null value will effectively short-circuit the function, returning that value instead.

Parameters

$prebool|null
The value to return instead. Default null to continue with the check.
$site_idint
The site ID that is being checked.

Source

$pre = apply_filters( 'pre_wp_is_site_initialized', null, $site_id );

Changelog

Version Description
5.1.0 Introduced.