posts_search filter-hookWP 3.0.0

Filters the search SQL that is used in the WHERE clause of WP_Query.

Usage

add_filter( 'posts_search', 'wp_kama_posts_search_filter', 10, 2 );

/**
 * Function for `posts_search` filter-hook.
 * 
 * @param string   $search Search SQL for WHERE clause.
 * @param WP_Query $query  The current WP_Query object.
 *
 * @return string
 */
function wp_kama_posts_search_filter( $search, $query ){

	// filter...
	return $search;
}
$search(string)
Search SQL for WHERE clause.
$query(WP_Query)
The current WP_Query object.

Changelog

Since 3.0.0 Introduced.

Where the hook is called

WP_Query::get_posts()
posts_search
wp-includes/class-wp-query.php 2152
$search = apply_filters_ref_array( 'posts_search', array( $search, &$this ) );

Where the hook is used in WordPress

Usage not found.