April, 2013

  1. Parse URL parameters using JavaScript

    I recently found myself in a situation where I had very limited access to remote content and needed to perform specific actions conditionally. I wanted a quick and clean way to parse URL query parameters inline. var vars = {};   window.location.search.replace(/(?:^\??|&)([^&=]*)=?([^&]*)/g, function(i, j, k) { if (j) vars[j] = k; });var vars = {};…

  2. Add taxonomy terms to WordPress posts

    Using core WordPress functions is ideal when possible for modifying any content. However, when you have hundreds of thousands of posts, updating post content such as taxonomy terms on many items at once can be quite slow. Use SQL statements to quickly update your content only if you know you aren’t going to need any…