title: Add a parameter to every link in my wordpress website
body: <p>I want to add a parameter to every link in my website, let's say ?var=123 .</p>
  
  <p>I tried to use those codes but nothing happened:</p>
  
  <pre><code>var has_querystring = /\?/; 
  
  $("a[href]").each(function(el) {
      if ( el.href &amp;&amp; has_querystring.test(el.href) ) {
          el.href += "&amp;var=123";
      } else {
          el.href += "?var=123";
      }
  });
  </code></pre>
  
  <hr>
  
  <pre><code>$('a[href]').attr('href', function(i, hrf) { return hrf + '?var=123';});
  </code></pre>
  
  <hr>
  
  <pre><code>$('a[href]').click(function(e) {
      e.preventDefault();
      window.location = this.href + '?var=123';
  });`
  </code></pre>
  
  <p>What am I doing wrong? Thank you.</p>