My First Patch: Peter Westwood – westi

Welcome to the first in a series of posts reflecting on the experiences around the first patch that a contributor wrote or had committed to the WordPress core. I thought I would start the ball rolling with myself and I hope to draw some other people in for future posts in this series.

I can just about remember what drove me to get involved and write one of my first patches for the core of WordPress just over 5 years ago.  I had run WordPress for about a year and a half and started to get a little obsessed with the number of database queries that were required to produce the front page of the site as they were slowing it down. It seemed to me that there were an a lot more queries that should be needed to output a list of 5 posts and the meta data associated with them.

It turned out, when I dug into what the queries were for, that most of them were related to the different options that were added by all the plugins I had loaded my site up with.  I found that there was a subtle performance issue in the way most plugins used add_option() and update_option().  Basically every time a plugin called add_option() WordPress would check to see if the option already existed and only add if it didn’t.  This seemed sensible except that for every option that was marked for “auto loading”. For these WordPress already knew they existed as it caches all the “auto load” options with a single query early on.

As can be seen from the ticket it took a little while before Ryan had time to review and commit the patch – It also turns out fellow lead developer Mark also had a hand in updating the patch when it went stale.

It really great to look back and reflect on “my first patch”. I had a great experience at the time. It was really nice to have a friendly community which nurtured me as I developed in my knowledge of WordPress and contributing to an open-source project.

Please let me know if you would like to share your experiences writing your first patch for the core of WordPress.

About Peter Westwood

Happiness Gardener, Coder, Cat Herder, Bug Tracker, Cook and Code Dreamer
This entry was posted in My first patch and tagged , . Bookmark the permalink.

3 Responses to My First Patch: Peter Westwood – westi

  1. filosofo says:

    I’d forgotten about the old “bg” for “bug-gardener” tag.

    You mention that you’d been using WordPress for a while up to that point. Had you been using it mainly professionally or personally when you got interested in contributing?

    • At that point I had only been using it personally.

      Prior to my first patch I had been helping out with the codex and in the #wordpress IRC channel if I remember correctly.

  2. My first patch was about three and a half years ago but it was never committed because the ticket was wontfixed. My second patch was a fix for wp_list_pages() so it respected the page order (menu_order field) when listing pages rather than just listing them alphabetically. It was a simple patch and Mark gave me my first props.

    Lloyd and yourself had provided plenty of helpful information to me by then (with Lloyd being especially helpful with regard to the Trac workflow) and it gave me the confidence to open tickets and attach patches knowing that they would actually be looked at and considered.

    A quick Trac search tells me I’ve patched about 55 things in WordPress in the three years since (not including the patches that never made it in 🙂 ). I think it’s great that anyone can still come along and patch things in a product that’s used by how-ever-many-millions of people around the world.

Comments are closed.