pre_get_col_charset
云策文档标注
概述
pre_get_col_charset 是一个 WordPress 过滤器,用于在数据库检查列字符集之前过滤其值。通过此过滤器,开发者可以自定义或绕过数据库查询,直接返回指定的字符集。
关键要点
- 过滤器名称:pre_get_col_charset
- 作用:在检查数据库列字符集之前过滤值,若返回非 null 值,则跳过数据库查询
- 参数:$charset(字符集,默认 null)、$table(表名)、$column(列名)
- 相关函数:wpdb::get_col_charset() 用于检索列字符集
- 引入版本:WordPress 4.2.0
原文内容
Filters the column charset value before the DB is checked.
Description
Passing a non-null value to the filter will short-circuit checking the DB for the charset, returning that value instead.
Parameters
$charsetstring|null|false|WP_Error-
The character set to use. Default null.
$tablestring-
The name of the table being checked.
$columnstring-
The name of the column being checked.
Source
$charset = apply_filters( 'pre_get_col_charset', null, $table, $column );
Changelog
| Version | Description |
|---|---|
| 4.2.0 | Introduced. |