Opened 4 years ago
Closed 4 years ago
#54866 closed feature request (wontfix)
Add 'go back' function to WordPress PHP
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | |
| Component: | Query | Keywords: | |
| Focuses: | Cc: |
Description
It could be helpful if you could add a "go back" PHP function to WordPress.
For example, if a user lands on the main page of a site https://places-to-eat-near-me.com/, then clicks on Restaurants in the navigation bar, and moves to another page on the same site https://places-to-eat-near-me.com/restaurants/, the user will be able to click on a 'go back' button in the navigation bar, or elsewhere on the page, to quickly go back to the last visited page on the site https://places-to-eat-near-me.com/.
Maybe something like this to print the href attribute of the last visited page on the site?
<?php get_last_page() ?>
It can be very useful in some occasions.
Thanks in advance!
Change History (2)
#2
@
4 years ago
- Milestone Awaiting Review deleted
- Resolution set to wontfix
- Status changed from new to closed
Hello @wpetro,
Welcome to WordPress Core's Trac! Thank you for your feature request.
The browser offers this feature and is best suited to provide the capability to go backwards through the web pages the user has explored.
Many sites are heavily cached (either through caching services or server-side features) or maybe in a headless environment. For these, the database may not be accessed when requesting a web page. For these sites, this feature would not work.
Given that the browser has the "back" feature built in and the limitations for the sites mentioned, I'll close this ticket. The resolution of wontfix may seems odd, though it's a classification to essentially mean the feature request is not a good fit for Core inclusion.
But again, thank you for opening the ticket and making the suggestion. Cheers!
That sounds like a job for a browser, and all of them have a Back button.
It wouldn't work in PHP, because the server has no(or an unreliable) record of what the last page was.