1

I want to get previous/next post, but to keep that within the same search query (I keep the searched terms from the previous page via the URL.) Is there any way to do this? It doesn't seem to be in the function get_adjacent_post() and my quick google search wielded no interesting results.

How could I do such a thing?

1 Answer 1

-1

I'm not entirely sure, but it seems like you want to store the last visited page for future use (a go back button?).

I see two ways to do this:

  1. Keep it in the URL as a get argument the same way you save the search queries. This leads to a long url, though
  2. Save it in the Browser as a cookie. This can be done via document.cookie in Javascript. Check the documentation out here: https://www.w3schools.com/js/js_cookies.asp

Let me know whether thats what you wanted. Kodos

1
  • Hello! Can you explain how the OP might implement those options? Brief examples would help, although don't just add copy paste solutions. Otherwise keep clarifying questions to the comments
    – Tom J Nowell
    Commented Jul 7, 2020 at 18:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.