jQuery cookie not working properly in wordpress

Ok, I solve this with the help of @TheDeadMedic’s help. I use wordpress cookiepath constant and it works on wordpress perfectly. Here is the jquery code: jQuery(document).ready(function () { // baking cookie ;p function set_cookie(ID) { document.cookie = ID + “=opened; path=<?php echo COOKIEPATH ?>”; } // getting it out from the oven… function get_cookies_array() … Read more

Serving Cookies From A Different Domain or Sub-Domain

Looks like I mis-interpreted what’s said in the codex. So, here’s the thing… This is what WordPress does by default: define(‘COOKIE_DOMAIN’, ‘.example.com’); — which means, cookies are sent with all the sub-domains, including example.com itself, even if your WordPress website itself is hosted on www.example.com. Basically the point is, when your WordPress site is served … Read more

Cookie value cannot be read until I’ve logged into the WP admin

It appears I needed to use an earlier hook. Using the wp or init action hooks allow me to read the cookie’s value without logging into the admin first. function output_test_cookie() { if ( isset( $_COOKIE[‘test-cookie’] ) ) echo $_COOKIE[“test-cookie”]; } add_action( ‘wp’, ‘output_test_cookie’ ); // wp or init is needed

Setting cookies in WordPress

Change this line setcookie( ‘cookiename’, ‘cookievalue’, time() + 3600, ‘mysite.net/sites/site1/’, ‘mysite.net/sites/site1/’); to setcookie( ‘cookiename’, cookievalue, time() + 3600, COOKIEPATH, COOKIE_DOMAIN);` COOKIEPATH and COOKIE_DOMAIN are WP constants now, but the codex is not updated yet.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)