Forums

need the right way to setcookie in wordpress (3 posts)

  1. wp-beginner
    Member
    Posted 8 months ago #

    i've been looking the whole day how to setcookies in wordpress. in my way i found out (using the developer toolbar) that the cookie is set but still not working. i have 2 files the first contains the login form redirecting to another page to set the cookie and return to another page to check if it's working. domain which is tested on is like this : blog.mydomain.com. here's the setcookie file :
    <?php
    setcookie("user_name","test",time()+3600);
    ?>
    and chcking the cookie like this :
    if(isset($_COOKIE["user_name"])){
    echo "cookie exists";
    }
    else{
    echo "cookie doesn't exist";
    }
    i've read many topics about this issue but there was no clear answer. Thanks in advance

    [mod: moved to 'How-to and Troubleshooting']

  2. Andrew Nevins
    Volunteer Moderator
    Posted 8 months ago #

    You're more likely to receive help if you create a thread in the 'How to..' forum.

  3. wp-beginner
    Member
    Posted 8 months ago #

    Thank you for your reply. Any help yet ?

Reply

You must log in to post.

About this Topic