posts_search_orderby filter-hookWP 3.7.0

Filters the ORDER BY used when ordering search results.

Usage

add_filter( 'posts_search_orderby', 'wp_kama_posts_search_orderby_filter', 10, 2 );

/**
 * Function for `posts_search_orderby` filter-hook.
 * 
 * @param string   $search_orderby The ORDER BY clause.
 * @param WP_Query $query          The current WP_Query instance.
 *
 * @return string
 */
function wp_kama_posts_search_orderby_filter( $search_orderby, $query ){

	// filter...
	return $search_orderby;
}
$search_orderby(string)
The ORDER BY clause.
$query(WP_Query)
The current WP_Query instance.

Changelog

Since 3.7.0 Introduced.

Where the hook is called

WP_Query::get_posts()
posts_search_orderby
wp-includes/class-wp-query.php 2498
$search_orderby = apply_filters( 'posts_search_orderby', $search_orderby, $this );

Where the hook is used in WordPress

Usage not found.