wpmu_drop_tables
云策文档标注
概述
wpmu_drop_tables 是一个 WordPress 过滤器,用于在删除站点时自定义要删除的数据库表列表。它允许开发者修改或扩展默认的表删除行为。
关键要点
- 这是一个过滤器,钩子名为 'wpmu_drop_tables',用于在站点删除过程中干预表删除操作。
- 接受两个参数:$tables(字符串数组,表示要删除的表名)和 $site_id(整数,表示站点ID)。
- 主要用于多站点环境,从 WordPress MU 3.0.0 版本引入。
- 相关函数 wp_uninitialize_site() 使用此过滤器来执行站点卸载。
原文内容
Filters the tables to drop when the site is deleted.
Parameters
$tablesstring[]-
Array of names of the site tables to be dropped.
$site_idint-
The ID of the site to drop tables for.
Source
$drop_tables = apply_filters( 'wpmu_drop_tables', $tables, $site->id );
Changelog
| Version | Description |
|---|---|
| MU (3.0.0) | Introduced. |