pre_get_table_charset

Filters the table charset value before the DB is checked.

Description

apply_filters( 'pre_get_table_charset', (null) $null, (string) $table ); 

Passing a non-null value to the filter will effectively short-circuit checking the DB for the charset, returning that value instead.

Parameters (2)

0. $null (null) => null
The character set to use. Default null.
1. $table (string)
The name of the table being checked.

Usage

To run the hook, copy the example below.
  1. $null = apply_filters( 'pre_get_table_charset', $null, $table ); 
  2.  
  3. if ( !empty( $null ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the pre_get_table_charset callback 
  2. function filter_pre_get_table_charset( $null, $table ) { 
  3. // make filter magic happen here... 
  4. return $null
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'pre_get_table_charset', 'filter_pre_get_table_charset', 10, 2 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'pre_get_table_charset', 'filter_pre_get_table_charset', 10, 2 ); 

Defined (1)

The filter is defined in the following location(s).

/wp-includes/wp-db.php  
  1. $charset = apply_filters( 'pre_get_table_charset', null, $table );