In a wordpress theme I have set up some search filters based on custom taxonomies, which will query posts using a URL structure like:

```
http://myblog.com/?taxonomy1=term1+term2&taxonomy2=term3+term4

```

In addition to these filters I want to integrate a text search but don't know how to append the search query (for example `?s=mysearchhere`) onto the existing taxonomy query. So in total I want the form, on submission, to lead to a url which combines the two strings:

"http://myblog.com/?taxonomy1=term1+term2&taxonomy2=term3+term4&s=mysearchhere"

So far I've tried generating the search form with the following functions:

```
 function remove_querystring_var($url, $key) { 
        $url = preg_replace('/(.*)(?|&)' . $key . '=[^&]+?(&)(.*)/i', '$1$2$4', $url . '&'); 
        $url = substr($url, 0, -1); 
        return $url; 
    }

function apl_search_form($echo = true) {
    do_action( 'get_search_form' );

    $search_form_template = locate_template('searchform.php');
    if ( '' != $search_form_template ) {
        require($search_form_template);
        return;
    }

    $url = $_SERVER["REQUEST_URI"]; 
    $action = remove_querystring_var($url,'s');

    $form = '<form role="search" method="get" id="searchform" action="' . $action . '" >
    <div><label class="screen-reader-text" for="s">' . __('Search for:') . '</label>
    <input type="text" value="' . get_search_query() . '" name="s" id="s" />
    <input type="submit" id="searchsubmit" value="'. esc_attr__('Search') .'" />
    </div>
    </form>';

    if ( $echo )
        echo apply_filters('get_search_form', $form);
    else
        return apply_filters('get_search_form', $form);
}

```

This doesn't seem to be working. Is this problem more complicated than it seems to me? Or am I on the right track? Does anyone know of a straightforward way of coding this?

Much thanks!