Caching for logged in user and Ajax update

There are plugins that can help you with this, but they aren’t foolproof. My suggestion is W3 Total Cache, you should be able to exclude necessary files from the cache from there. Your best solution, however is to do caching on the serverside level as you will see better performance that way.

How to set a cookie based on a page Get variable?

On the page where you want to set the cookie write this code and check if(get_query_var(‘my_var’) == ‘somevalue’){ setcookie(‘my_cookie’, get_query_var(‘my_var’), strtotime(‘+1 day’)); } If we go with your code then it will set coookie on every page who having query variable ?my_var=somevalue