# How to add variables to the “redirect to url” or the “show more url”?

&#x20;This will only work on plugin version **4.9.5** or later!

Both strings are filtered before output, so you can use a custom function to do the job:

[What is this, and where do I put this custom code?](/safe-coding-guideline.md)\
Change the **$values** array to add/remove query *param=>value* pairs.

```php
// Use this to change the "redirect to url" parameter
add_filter( 'asp_redirect_url', 'asp_add_params_to_url', 1, 10 );
// Use this to change the "show more results url" parameter
add_filter( 'asp_show_more_url', 'asp_add_params_to_url', 1, 10 );

function asp_add_params_to_url( $url ) {
  // Array of param names and values
  $values = array(
    "param1" => "value1",
    "param2" => "value2",
    "param3" => "value3"
  );
  // Merge them together
  foreach ( $values as $k => $v )
    $url .= "&".$k."=".$v;
  
  return $url;
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://knowledgebase.ajaxsearchpro.com/miscellaneous/tutorials/how-to-add-variables-to-the-redirect-to-url-or-the-show-more-url.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
