How can I link to another WordPress page but move variables to it as well (preferably not through the address bar)?
For instance, I have on one page a list of shops in which a user should be able to click on a shop, which would then open the shop page with the correct data.
So the shop’s id needs to move from the shops list page to the shop page.
1 Answer
you could POST
the shop id to the target page. otherwise- cookie, session. or just fetch it on the list page via ajax.
edit – a simple post request via a form:
in your source page:
<form action="b.php" method="post">
<input type="hidden" name="id" value="42" />
<input type="submit" />
</form>
in the target page b.php:
<?php
if( isset($_POST['id']) ):
echo $_POST['id'];
endif;