WP_Query: Get Posts by Relative Date

Someone asked me today how to use WP_Query to get posts by a relative date. The codex provides an example on how to achieve this. Heres what is shown on the codex. I feel that its sloppy and not very flexible. Having to add the filter and remove it each time you want to do this is ugly. I solved this some time ago and had to dig through some old code to find it. ...

April 11, 2013 · 1 min · 140 words

Media Categories 1.5 Beta and WordPress 3.5

This week WordPress 3.5 was released, and the core team has made a some great improvements to the way media is handled in the UI. I managed to get my name in the credits for a measly few lines I contributed in a couple of patches - nonetheless I’m proud to be a part of it. The reason I created the Media Categories plugin is because of how neglected the interface for media was. Especially with regard for anyone wanting to add support for taxonomy. In 3.5 media still comes without any taxonomy enabled out of the box (as it should be) - but for those who those who do the custom work of enabling one, the interface is now much improved. ...

December 13, 2012 · 3 min · 580 words

Media Categories 1.3.1 & a Trac Ticket with Patch

I didn’t have a chance to post about this, but last week I quietly released Media Categories 1.3.1, to workaround a problem which was reported to me on the support forums in the WordPress Plugin directory. A user of the Media Categories plugin explained that some under certain circumstances, categorized media would not save properly. Here are the steps to reproduce the problem: Create two categories with the same name, but different slugs. Open up an attachment while Media Categories 1.3 or below are turned on. (download that version here) Select the two same-name categories, and click save. WordPress will take you back to the Media Library. Open the same attachment again, and click save, without having changed anything. Open that attachment once more. You will find that one of the categories that had a duplicate name, is no longer selected. The first thing I did was turn off the styling on my plugin, which hides a text field that WordPress creates when an attachment has taxonomy support and watched what it did as I went through each of the steps above. This field will take term ID’s, slugs, and names - it can take any number of terms, each separated by commas - but requires the user to manually enter them from memory, which I why I built my plugin. ...

June 3, 2012 · 3 min · 554 words

Moving the Uploads Directory in WordPress

To give context, I will start from the beginning,… If you’ve come here simply looking for any way to move the uploads directory - skip all this and jump straight to Moving the Uploads Directory… Moving wp-content There are many times when its a great idea to move some of the default locations of certain directories in WordPress. At my current job, we have a handful of sites that all share a the same plugins and theme folders. However, when I arrived at this position a few months ago, they had done this by using symbolic links - this causes problems with many plugins due to their use of the __FILE__ magic constant. As a result it was necessary to modify many of the 3rd party plugins we had remove that constants use. ...

August 23, 2011 · 5 min · 889 words