why not use the init
action hook:
function has_my_cookie()
{
if (!is_admin()){
//Check to see if our cookie is set if not redirect to your desired page and set the cookie
if ( !isset($_COOKIE["sevisitor"])) {
//setcookie
setcookie('sevisitor', 1, time()+1209600, "https://wordpress.stackexchange.com/", "http://localhost/child/", false);
//Redirect
wp_redirect( get_site_url().'/about-myself' ); exit;
}
}
}
add_action('init', 'has_my_cookie');
Related Posts:
- Setting a redirect cookie in wordpress
- Creating intro page in wordpress
- $_SESSION variables lost during OAuth callback
- After logout browser’s back button into twenty sixteen theme profile
- store URL global before we redirect
- How can I set up a splash page that is redirected to only one time for the visitor? [closed]
- Accept (once only) policy page on login
- How to redirect non-logged in users to a specific page?
- When I change slug, will WordPress create redirect from the old URL?
- Why am I getting a 301 on a existing post?
- Keeps on redirecting on my development copy
- Password change when the user login first time
- Custom login form redirect to external site
- Implementing global redirection (automatic redirect for all pages who had their slug changed)
- Redirect to custom url when registration fails?
- Exclude a path from WordPress using .htaccess redirects (Apache)
- How to redirect url requests to https? [closed]
- Best way to handle redirects
- Redirect to custom URL after registering from a page with registration form
- Stop unwanted WP redirection to new url
- htaccess redirect not working
- htaccess wildcard redirect misses some URLs
- 404 redirection and Google’s index [closed]
- Redirect user after logout
- WWW to non WWW redirect effects on load speed
- 302 redirect to signup with nginx reverse proxy
- How to redirect user to specific page based on the input password
- Redirect HTTP to HTTPS
- Change gravity forms confirmation redirect query string to include entry id [closed]
- How to redirect visitor to a custom URL using PHP code in functions.php
- Deny access to a path (give 403 or 404 response)
- Redirect home to another page with htaccess
- How do I redirect /search/ to ?s=
- 301 Redirect Loop
- Infinite loop behind SSL proxy on non-standard port
- Redirect if $_Server[‘REQUEST_URI’] is /wp-login.php?checkemail=registered
- .htaccess rule to redirect old URLs to new structure [closed]
- .htaccess Redirect
- Redirect when accessing /login when logged in
- How can I redirect a URL to an anchor link while maintaining the URL?
- How to remove duplicate and unnecessary part in a url using htaccess and regex?
- Built-In Postname Redirection vs Hard Redirects in relation to SEO and performance
- Local Environment Stripping Port Number…help tracking down the redirect?
- User is logged in after Stripe payment, then redirected, but is then logged out again
- Redirect “http://old.net/category/postname” to “https://new.com/postname”?
- Image URLs not redirecting properly
- 301 Redirect Old URL to New WordPress Page
- URL masking of subdomain to main domain using .htaccess
- Redirecting from wp-content?
- WP page 404 error only on mobile
- Redirect user on first visit based on geographical location
- My site doesn’t redirect from HTTP to HTTPS
- Bedrock WordPress
- How to prevent redirect 301
- Redirect one domain to another
- Only execute function if SSL is set up properly
- How to redirect wp_login_form to new page after user loged in?
- Redirect User to login page
- How to redirect multiple subfolders back to root domain?
- How do I Redirect Tags from Old Joomla Site to New WordPress Site?
- How to redirect user after login to the page called by his first name?
- Redirect after get_delete_post_link
- Whenever I try to publish a post in wordpress, I always get redirected to the installation page…why?
- Login redirect to previous page
- Old missing file in wp-content/uploads/ returns a 500 error, how to catch and redirect?
- Redirect when not logged and parametr in link
- How do redirect user back to previous page when on certain pages?
- Relink Drupal Permalinks “…node/XXXX” to wordpress Permalinks (e.g./audio/)
- Hide a Post everywhere except on redirect
- Redirect Image URL to it’s parent post
- Redirect user if they are logged in
- URL redirect regular expressions redirecting all after first viriable
- WordPress site not forcing from http to https instead getting redirected too many times
- Redirect not work
- There is 1 redirect
- How to create mass 301 redirects with PHP in Nginx server without using a WP plugin
- HOW do you Redirect buddypress login to EDIT tab not PROFILE tab on profile page? [closed]
- Redirect HTTP request to HTTPS request
- All new posts serving 301 redirect
- Moving site from HTTP to HTTPS
- Redirect from plugin created page
- Woocommerce login to specific page or referrer
- 301 Redirects when change URL in WordPress database
- How can I redirect to another page with screen already at the bottom of the page?
- Tag archive page not working
- Custom redirects with using SQL
- How to move a https website back to dev and access the admin?
- Getting error when trying to redirect WP site to mobile site
- Custom Form Redirects to Post after Submit
- wp_login_form: Redirect to dynamic url according to username
- Plugin redirects URL structure using 301 redirect. Time to disable the plugin?
- URL is redirecting (301) when query string is passed through URL
- Plugin html-on-pages: URL not redirecting
- Redirect a WP to another with all URL
- How to disable login and registration pages?
- How to redirect users without permission to view content to a custom page?
- redirect the root of a domain, while leaving the www version unredirected
- How to Create Custom Route to a page in WordPress
- How to create a redirect to another domain like safe redirect manager from php
- Post Migration Site Migration Redirects All Known Solutions Attempted