# Clear the query parameters using code?

**URL:** <https://forum.wixstudio.com/t/clear-the-query-parameters-using-code/2594>\
**Category:** Ask the community\
**Tags:** code, question\
**Created:** [October 11, 2018, 10:51am UTC](https://forum.wixstudio.com/t/clear-the-query-parameters-using-code/2594 "2018-10-11T10:51:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![andreas-kviby](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/andreas-kviby/32/790_2.png) [@andreas-kviby](https://forum.wixstudio.com/u/andreas-kviby)\
**Post date:** [October 11, 2018, 10:51am UTC](https://forum.wixstudio.com/t/clear-the-query-parameters-using-code/2594/1 "2018-10-11T10:51:51Z")

</div>

Hey all!  
Let’s say you have the query parameter ?r=bobba in a url in your Wix site and then you use the wixLocation.to(“/login”) and you want that query parameter gone. Is there a way of doing this? It seem that the query parameter is always added to the wixLocation.to command.

---

<div class="post-metadata">

**Author:** ![ahmdjsalhi](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/ahmdjsalhi/32/6516_2.png) [@ahmdjsalhi](https://forum.wixstudio.com/u/ahmdjsalhi)\
**Post date:** [October 11, 2018, 12:08pm UTC](https://forum.wixstudio.com/t/clear-the-query-parameters-using-code/2594/2 "2018-10-11T12:08:24Z")

</div>

Hey,  
I think this could help you:

**import** wixLocation **from** ‘wix-location’;

**let** baseUrl = wixLocation.baseUrl;  
wixLocation.to(baseUrl + “/login”)

you also could get the path if you need it by using (.path):  
let path = wixLocation.path;

this link could help you to know more about wix-location:  
[http://www.wix.com/code/reference/wix-location.html#path](http://www.wix.com/code/reference/wix-location.html#path)

good luck.

---

<div class="post-metadata">

**Author:** ![giri-zano](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/giri-zano/32/80469_2.png) [@giri-zano](https://forum.wixstudio.com/u/giri-zano)\
**Post date:** [October 11, 2018, 7:28pm UTC](https://forum.wixstudio.com/t/clear-the-query-parameters-using-code/2594/3 "2018-10-11T19:28:35Z")

</div>

Andreas, I ran into the same problem a while back. There is no solution: every link suddenly carries the query-part, even links in your menu to homepage, etc. I have tried resetting, deleting, nada.  
You can only change values, not delete them. it´s a nuisance.

---

<div class="post-metadata">

**Author:** ![thrishtilabs](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/thrishtilabs/32/950_2.png) [@thrishtilabs](https://forum.wixstudio.com/u/thrishtilabs)\
**Post date:** [October 11, 2018, 9:17pm UTC](https://forum.wixstudio.com/t/clear-the-query-parameters-using-code/2594/4 "2018-10-11T21:17:04Z")

</div>

Hi @Ahmd,

Your method will work…but it will reload the wix webapp which takes lot of time (comparatively)and the page loads from the beginning…

But if use [wixLocation.to](http://wixlocation.to/) (“/login”) , the wix web app will not be reloaded and it will move faster to the desired page. But in this case the query parameters follows to the next page…

It is a wix design flow and should be implemented as soon as possible… I am waiting in this forum since 1.5 years to see wix developers implement basic things first instead of sci fiction features… Thanks…

---

<div class="post-metadata">

**Author:** ![nino](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/nino/32/2394_2.png) [@nino](https://forum.wixstudio.com/u/nino)\
**Post date:** [February 24, 2019, 5:33am UTC](https://forum.wixstudio.com/t/clear-the-query-parameters-using-code/2594/5 "2019-02-24T05:33:33Z")

</div>

@andreas-kviby I just got into the same problem and for a quick solution that I did was setting the button or the object onClick event to:

```javascript
export function yourbutton1_click (parameter){
wixLocation.to("http://yoursite.com/login")
}

```

Let me know what you think. I am curious to see how they will fix this. Best of luck!

---

<div class="post-metadata">

**Author:** ![peterjanderson672](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/peterjanderson672/32/8461_2.png) [@peterjanderson672](https://forum.wixstudio.com/u/peterjanderson672)\
**Post date:** [March 30, 2019, 12:14pm UTC](https://forum.wixstudio.com/t/clear-the-query-parameters-using-code/2594/6 "2019-03-30T12:14:15Z")

</div>

Same problem here.  
Wix:  
Surely there must be a way to clear the query so that it doesn’t get appended to every link (even menu links) thereafter?
