title: I'm trying to get jQuery to set a cookie ui WordPress
body: <p>I'm trying to create a page which sets a cookie so I can exclude people from Google Analytics in a WordPress site</p>
  
  <p>I'm trying to set this up using custom jQuery, but there is something wrong with the code I'm using</p>
  
  <p>Here's the link code</p>
  
  <pre><code>&lt;a id="hidemelink" href="#"&gt;Click to Set Cookie&lt;/a&gt;`
  </code></pre>
  
  <p>and the jQuery code</p>
  
  <pre><code>jQuery('#hidemelink').click(function(){
      jQuery.cookie("HideMe", "HideMe", {
          expires : 400, 
          path    : '/'  
      };
      alert('HideMe cookie set');
      return false;
  });
  </code></pre>
  
  <p>The problem is with the jQuery.cookie bit. If I remove </p>
  
  <pre><code>jQuery.cookie("HideMe", "HideMe", {
      expires : 400, 
      path    : '/'  
  };
  </code></pre>
  
  <p>and just leave the alert &amp; return statements, the code executes fine - the alert is displayed and I stay on the page.</p>
  
  <p>However, when I put the cookie code in, the alery isn't displayed &amp; I'm redirected to the home page.</p>
  
  <p>This is probably something incredibly simple, but I just can't see it. Help would be much appreciated</p>
  
  <p>Many thanks in advance</p>