I have a function that applies a query_var to all links in a page if the query_var exists for the current page.
So if I change
https://liquidchurch.com/messages/
to
https://liquidchurch.com/messages/messages-app-view/
then all the links for terms on the page are updated to look something like this:
https://liquidchurch.com/sermon-series/divine-direction/message-app-view/
The problem is with the pagination at the bottom of the page. If you look at the /messages page while messages-app-view is appended you'll see that the permalink to the next page looks like:
https://liquidchurch.com/messages/messages-app-view/page/2/
Problem is that this will return a 404. Ideally I'd like for the URL to be:
https://liquidchurch.com/messages/page/2/messages-app-view/
Alternatively, I suppose a regex would work that checks if /page/x/ is listed after messages-app-view.
Thoughts on how I should accomplish this? Thanks!