Filter hook 'pre_get_col_charset'

in WP Core File wp-includes/class-wpdb.php at line 3316

View Source

pre_get_col_charset

Filter Hook
Description
Filters the column charset value before the DB is checked. Passing a non-null value to the filter will 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 3316

Hook Parameters

Type Name Description
string|null|false|WP_Error $charset The character set to use. Default null.
string $table The name of the table being checked.
string $column The name of the column being checked.

Usage Examples

Basic Usage
<?php
// Hook into pre_get_col_charset
add_filter('pre_get_col_charset', 'my_custom_filter', 10, 3);

function my_custom_filter($charset, $table, $column) {
    // Your custom filtering logic here
    return $charset;
}

Source Code Context

wp-includes/class-wpdb.php:3316 - How this hook is used in WordPress core
<?php
3311  		 *
3312  		 * @param string|null|false|WP_Error $charset The character set to use. Default null.
3313  		 * @param string                     $table   The name of the table being checked.
3314  		 * @param string                     $column  The name of the column being checked.
3315  		 */
3316  		$charset = apply_filters( 'pre_get_col_charset', null, $table, $column );
3317  		if ( null !== $charset ) {
3318  			return $charset;
3319  		}
3320  
3321  		// Skip this entirely if this isn't a MySQL database.

PHP Documentation

<?php
/**
		 * Filters the column charset value before the DB is checked.
		 *
		 * Passing a non-null value to the filter will short-circuit
		 * checking the DB for the charset, returning that value instead.
		 *
		 * @since 4.2.0
		 *
		 * @param string|null|false|WP_Error $charset The character set to use. Default null.
		 * @param string                     $table   The name of the table being checked.
		 * @param string                     $column  The name of the column being checked.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 3
  • File: wp-includes/class-wpdb.php
Related Hooks

Related hooks will be displayed here in future updates.