My first WordPress Core patch

A few days ago, I proudly landed my first patch for WordPress Core.

It started with me being frustrated over a limitation of the wp_get_archives function, that can list the archives only in counter-chronological, not in chronological order — an obvious oversight from the early days of WP, when it was viewed as a simple blogging platform.

I noticed that the issue had been raised several times in the WordPress forum, without a practical workaround, so I decided to file a feature request on Trac (that’s the place where anybody can report bugs, or propose new features and enhancements). I quickly got an answer from Scribu, a very active WP developer, who encouraged me to submit a patch.

Although I didn’t expect myself being able to produce any working code, I decided to take up the challenge, in order to gain a better understanding of the development workflow of WP. The fact that I attended a nice presentation about Version Control Systems last week did also help quite a bit.

To my own surprise, it took me only a few minutes to isolate the piece of code that was handling the wp_get_archives function. There I noticed that indeed, the ordering was strictly defined as “DESC” (descending, from newest to oldest), while other parameters had more flexible values. Through a minimal copy-paste intervention, I brought the function to support both ASC and DESC, ascending (chronological) and descending ordering of archives.

Now I’m crossing fingers, hoping that this patch will sip into the wordpress trunk… anyhow, I think that the speed at which a php dilettante could step in and improve the code without breaking everything speaks in favor of (a) the clarity/modularity of the WP source code, and (b) the open-mindedness of the development team towards outside contributors of any level.

It was a very enjoyable experience, and I’m looking towards the next occasion of improving my web publishing platform of choice.

Update (2012-08-24)

It looks like the patch has been accepted, and will be part of WordPress 3.5. Yay!