Redirect to the page where user came from Redirect to the page where user came from wordpress wordpress

Redirect to the page where user came from


Try this button maybe as told here:

<input action="action" type="button" value="Back" onclick="window.history.go(-1); return false;" />

If your previous page URL does not have page section info like www.yoursite.com/somePage#someSection, you can push custom URL to the history stack before leaving that page, so that whenever your go back, you not only go back to the page but also the specific portion that you came from. You can push custom URL to the history stack maintained by the browser as described here


Try this code to utilize page visit history maintained by the browser:

<button onclick="goBack()">Go Back</button><script>function goBack() {    window.history.back();}</script>