How can I redirect to home when user click on back button after logout?

Hi there check the wp_logout_url($redirect_url) .

Up vote 0 down vote favorite share g+ share fb share tw.

I was wondering how can I redirect users to my hompage after they logged out when they hit the back button, kind of like facebook does. I was playing around with some javascript but nothing seemed to work. PD: This will be for a Wordpress theme.

Thanks in advance! Php wordpress logout back link|improve this question asked Mar 4 '11 at 13:50javiervd454110 100% accept rate.

Hi there check the wp_logout_url($redirect_url).

Its not the logout function that I need, is the redirect when the user clicks back in the browser, if I use that it works fine but then if I click back on my browser it will show me that last screen where I was, I wan't to show my home screen instead – javiervd Mar 5 '11 at 17:37.

If you use sessions, you can check if the user is logged in when viewing an authenticated page, and if not, send the headers to your homepage.

I already use a verification with php, and it works fine (its pretty much if (!user_is_loggedin) redirect to main page; but the problem with loggin out and going back is that the browser seems to bypass this check and just loads the previous screen, however if I attempt to do anything here like clicking a link it does redirect me to the loggin page. I've seen it work like this in almost every site, actually facebook is the only one I've found that works like that, and sadly my client wants it that way... – javiervd Mar 4 '11 at 17:12 are you destroying the session completely? – Dave Kiss Mar 4 '11 at 21:20.

Javascript seems like the way to do it. Simply check if the user is logged and if not, do a redirect to the home page via a document. Location = "http://my.home.

Page"; I guess that you have the session in PHP too so you could just do the redirect there instead of relying on Javascript. Header ('Location: http://your.home. Page').

I already use a verification with php, and it works fine (its pretty much if (!user_is_loggedin) redirect to main page; but the problem with loggin out and going back is that the browser seems to bypass this check and just loads the previous screen, however if I attempt to do anything here like clicking a link it does redirect me to the loggin page. I've seen it work like this in almost every site, actually facebook is the only one I've found that works like that, and sadly my client wants it that way... – javiervd Mar 4 '11 at 17:13 OK I see the problem. When you click back, it recovers the page from cache.

You can try disabling cache. Please see this link : linkgo4expert.com/forums/showthread.php?... and keep in mind that some browsers might handle this awkwardly. You can also try to reverse engineer the javascript used by Facebook.

– Jonthemoon Mar 7 '11 at 19:21.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions