Можно вот так попробовать:
function __search_by_title_only( $search, &$wp_query ){
global $wpdb;
if ( empty( $search ) ) return $search;
$searchTitle = $wpdb->posts.post_title;
$searchContent = $wpdb->posts.post_content;
$q = $wp_query->query_vars;
$n = ! empty( $q['exact'] ) ? '' : '%';
$search =
$searchand = '';
foreach ( (array) $q['search_terms'] as $term ) {
$term = esc_sql( like_escape( $term ) );
$search .= "{$searchand}($searchTitle LIKE '{$n}{$term}{$n}')";
$searchand = ' AND ';
$search .= "{$searchand}($searchContent LIKE '{$n}{$term}{$n}')";
}
if ( ! empty( $search ) ) {
$search = " AND ({$search}) ";
if ( ! is_user_logged_in() )
$search .= " AND ($wpdb->posts.post_password = '') ";
}
return $search;
}
add_filter( 'posts_search', '__search_by_title_only', 500, 2 );