query filter-hookWP 2.1.0

Filters the database query.

Some queries are made before the plugins have been loaded, and thus cannot be filtered with this method.

Usage

add_filter( 'query', 'wp_kama_query_filter' );

/**
 * Function for `query` filter-hook.
 * 
 * @param string $query Database query.
 *
 * @return string
 */
function wp_kama_query_filter( $query ){

	// filter...
	return $query;
}
$query(string)
Database query.

Changelog

Since 2.1.0 Introduced.

Where the hook is called

wpdb::query()
query
wp-includes/class-wpdb.php 2309
$query = apply_filters( 'query', $query );

Where the hook is used in WordPress

wp-includes/class-wpdb.php 2537
add_filter( 'query', array( $this, 'remove_placeholder_escape' ), 0 );