Cookie only detected when visitor is logged in

ANSWER TO MY OWN QUESTION This was something I had been trying to debug for the last couple of days. And the answer was found by mistake. What caused the error was caching. I had to exempt the cookie from cache in order for it to work as it should. So, if you are experiencing … Read more

How set a cookie from PHP and get it without refresh

You need to use the ‘init’ hook similar to the following: add_action( ‘init’, ‘your_function’); function your_function() { setcookie(‘my_cookie’,’tmp_val’); wp_redirect( get_permalink() ); exit; } } You should add a conditional ‘if’ statement in there to prevent it redirecting on every page though! eg. add_action( ‘init’, ‘your_function’); function your_function() { setcookie(‘my_cookie’,’tmp_val’); if ($my_cookie == “???”) { wp_redirect( … Read more

Unset a Cookie on Successful Gravity Forms form Submission [closed]

I ran this code to try setting a cookie on the gform_after_submission hook and it worked as expected. add_action( ‘gform_after_submission’, function() { setcookie( ‘boom’, ‘boom’, time() + 3600, “https://wordpress.stackexchange.com/” ); } ); The headers should not already be sent when the gform_after_submission action is triggered. If you’re getting a warning about this, there might be … Read more

Show greetings on first time visitors?

if you are not looking at coding it yourself then WP Greet Box(http://wordpress.org/extend/plugins/wp-greet-box/) could be used to achieve this. This plugin automatically loads a greeting message based on the referrer and it even allows you to customize the greetings, set time out to auto close the greeting etc. The only problem I see(from your question) … Read more

Deleting cookie to logout

You can log out the current user with wp_logout() function: I think it is much better approach. wp_logout() destroys current session, clears authorization cookie and call wp_logout action. Also, it is a pluggable function, which means can be redefined by plugins. You can miss important stuff, specially when working in combination with other plugins. If … Read more

Secure wordpress_logged_in cookie

The advantage of a filter is that you can change a value without modifying core WP files. The filter you list: $secure_logged_in_cookie = apply_filters(‘secure_logged_in_cookie’, false, $user_id, $secure); Passes in three values. You just need to build a function that accepts those three values and returns true (or just returns true by default. This function, for … 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

techhipbettruvabetnorabahisbahis forumutaraftarium24eduseduseduedusedueduseduseduseduedu