Archived topic
Intro page showed just one time
5 replies · Started by maurizio elvetico on June 2, 2015
Hi Tom
I have made a static intro page with a specific template. I want show it just one time. I have add at the beginning of the template the following code:
<?php
if(! $_COOKIE['visited']) {
setcookie("visited", '1');
}
else {
header('Location: http: //mysite/?page_id=2');
}
?>
It isn't work as the cookie is always true also if I reset the cookies in my firefox.
In which way Cookies work in wordpress?
Can you give me some advice?
thanks a lot
Hi there,
This plugin looks like it may do what you want: https://wordpress.org/support/plugin/redirect-to-welcome-or-landing-page
Hi Tom
Thank you for your quickly reply, but the redirect plugin doesn't work on my site too.
The code in the plugin is the same of the mine.
As I told the $_COOKIE('visited') is always set.
Perhaps it has to reset when all is starting ?. For example, it must be reset in the wp-head hook (by GP-hook)? and why?
Now I'm testing in local to understand more.
The plugin I linked to would most likely set a different cookie name.
Are you sure you have cookies enabled in your browser?
I just tested that plugin and it worked well for me - no need to do anything to wp_head.
I installed it and went to "Settings > Redirect to landing page".
I entered my URL to redirect to, and set it to "All pages".
Next time I tried to visit the site, I was redirected to that page.
Hi Tom
I have resolved. The problem is on the way to work.
From the dashboard it takes little to enable cookies for example simply going on edit page or when I am in GP-Customise. It was necessary to close the panel and restart the browser.
I am satisfied with the choice GP
thank you very much
Happy I could help! :)
