function hotlinkers_wp_query($query) {
if ( !$query->is_admin && $query->is_search) {
$search_query = str_replace('-',' ', $query->query_vars['s']);
$query->set('s', $search_query);
}
return $query;
}
add_action('pre_get_posts', 'hotlinkers_wp_query');
this is for the search results found, on search.php i have an else, so if no searches are found it shows 15 random posts (using wp query)
wanted to avoid that if possible to do via pre_get_posts.