Add Additional Cookie on WordPress

wordpress-logo
Today I realize that the simple setcookie("sevisitor", 1, time()+3600); would not work perfectly on WordPress especially when your combine it with WordPress permalink. Here a simple hack that you can opt for if you want to set in multiple WordPress environment (especially for plug-ins and themes).

setcookie("sevisitor", 1, time()+3600,
    SITECOOKIEPATH, COOKIE_DOMAIN, false, true);

There are multiple alternative for it but this work perfectly on multiple installation.

Posted in How-To, WordPress | 4 Comments

4 Responses to Add Additional Cookie on WordPress

  1. Tech Gadget says:

    WOW! I didn’t had any idea about that! Thanks.

  2. Ben says:

    Today you saved my life. Thanks

  3. Pingback: wp-popular.com » Blog Archive » Add Additional Cookie on WordPress — Mior Muhammad Zaki

  4. Tobias says:

    Thanks man…! After a few hours I finally found your post..! Great solution ..! Im comming back, thats for sure :D

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>