pre_get_table_charset
Filter HookDescription
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.Hook Information
File Location |
wp-includes/class-wpdb.php
View on GitHub
|
Hook Type | Filter |
Line Number | 3216 |
Hook Parameters
Type | Name | Description |
---|---|---|
string|WP_Error|null
|
$charset
|
The character set to use, WP_Error object if it couldn't be found. Default null. |
string
|
$table
|
The name of the table being checked. |
Usage Examples
Basic Usage
<?php
// Hook into pre_get_table_charset
add_filter('pre_get_table_charset', 'my_custom_filter', 10, 2);
function my_custom_filter($charset, $table) {
// Your custom filtering logic here
return $charset;
}
Source Code Context
wp-includes/class-wpdb.php:3216
- How this hook is used in WordPress core
<?php
3211 *
3212 * @param string|WP_Error|null $charset The character set to use, WP_Error object
3213 * if it couldn't be found. Default null.
3214 * @param string $table The name of the table being checked.
3215 */
3216 $charset = apply_filters( 'pre_get_table_charset', null, $table );
3217 if ( null !== $charset ) {
3218 return $charset;
3219 }
3220
3221 if ( isset( $this->table_charset[ $tablekey ] ) ) {
PHP Documentation
<?php
/**
* 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.
*
* @since 4.2.0
*
* @param string|WP_Error|null $charset The character set to use, WP_Error object
* if it couldn't be found. Default null.
* @param string $table The name of the table being checked.
*/
Quick Info
- Hook Type: Filter
- Parameters: 2
- File: wp-includes/class-wpdb.php
Related Hooks
Related hooks will be displayed here in future updates.