pre_get_table_charset
Filters the table charset value before the DB is checked.
Returning a non-null value from the filter will effectively short-circuit checking the DB for the charset, returning that value instead.
Использование
add_filter( 'pre_get_table_charset', 'wp_kama_pre_get_table_charset_filter', 10, 2 );
/**
* Function for `pre_get_table_charset` filter-hook.
*
* @param string|WP_Error|null $charset The character set to use, WP_Error object if it couldn't be found.
* @param string $table The name of the table being checked.
*
* @return string|WP_Error|null
*/
function wp_kama_pre_get_table_charset_filter( $charset, $table ){
// filter...
return $charset;
}
- $charset(строка|WP_Error|null)
- The character set to use, WP_Error object if it couldn't be found.
По умолчанию: null - $table(строка)
- The name of the table being checked.
Список изменений
| С версии 4.2.0 | Введена. |
Где вызывается хук
pre_get_table_charset
wp-includes/class-wpdb.php 3226
$charset = apply_filters( 'pre_get_table_charset', null, $table );