I am not 100% sure what you are trying to accomplish, but you can “search for both strings” simply by concatenating them:
function checkForAa($query){
if($query->is_search){
$search_string = $query->get( 's' );
if( stripos( $search_string , 'aa' ) !== false){
$new_string = str_ireplace( 'aa' , 'xxx' , $search_string );
}elseif( stripos( $search_string , 'å' ) !== false){
$new_string = (str_ireplace( 'å', 'aa' , $search_string ));
}
if( !empty( $new_string ) ){
// Concatenate the strings
$query->set( 's', $new_string.' '.$search_string);
}
}
}
add_filter('pre_get_posts', 'checkForAa');
$s="aabcd";
$query1 = new WP_Query(
array(
'posts_per_page' => 3,
's' => $s
)
);
var_dump($query1->request);
This kind of search will become very inefficient, very quickly, with long strings though.