That works great on the current url you’re on like if you visited an archive page. But if that url contained search parameters like it would when performing my custom search, it won’t work because those previous search parameters are removed and you’re left with the root url with the orderby and order parameters appended to the end.
I think the problem is that after I run the search, those variables aren’t stored anywhere to access again, they are just in the url. So if I try and append the orderby and order to the end of the url, it doesn’t remember what the previous values were.
Is there any way I can store the searched parameters for use again in the subsequent sort options?
Probably cookies but not sure if that’s the right way?
I got it! The variables that I defined are available after the search form is processed. So what I did was include those variables within the url and then appended the orderby and order to the end. For example: