Clear the query parameters using code?

Hey all!
Let’s say you have the query parameter ?r=bobba in a url in your Wix site and then you use the“/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 command.

1 Like

I think this could help you:

import wixLocation from ‘wix-location’;

let baseUrl = wixLocation.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:

good luck.

1 Like

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.


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 (“/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…


@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:

export function yourbutton1_click (parameter){"")

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

1 Like

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