Skip to content
Home » Blog » My first contribution to WordPress core; and how you can do the same.

My first contribution to WordPress core; and how you can do the same.

WordPress 4.6 was released just a few days ago. There were a lot of contributors that helped make WordPress 4.6 a reality. I’m proud to say that I was one of them. I never thought I’d be able to make the list but thanks to some help, I was able to contribute in my own way. The following is my experience contributing to WordPress.

During the development of WordPress 4.6, I used the WordPress Beta Testing plugin to keep up with changes on my local server. While I was not able to find a bug, I kept looking on trac and came across a ticket which was concentrating on the user interface, and was really easy to fix, you can see it for yourself

Is changing text really a contribution?

When I bumped on the ticket, I thought about whether just changing text would classify as a contribution. It was a small change that involved changing label for a button. and then I came across a blog post by Jeff Chanfler on WP Travern, This article talks about the experience Jeff had when he made his first core contribution. And surprising enough it was a typo which he reported and gave a patch for.

What he talked about in the blog post was interesting, I learnt that people have contributed to WordPress simply by removing whitespace from or adding underscores to code. No contribution is small when it comes to WordPress. So don’t worry what contribution you do, however, small is that, take pride in the contribution you have done.

Getting My Patch Into Core

After knowing about the bug, I just installed the trunk to a local VVV install, took a fresh pull again to be sure. Made the changes required, and prepared a patch.

Don’t worry, creating a patch is super easy, especially if you are using one of the Linux distro or any UNIX-based computer. It needs some installations to be done on Windows, though. You can read more about it here, OR keep reading below.

Creating a Patch/Diff file

Setting up the Development Site
There are various ways you can setup a development environment; the best and the most comfortable I found to work with is Vagrant VVV by 10up.
All you need to do it create a directory with the name you wish it to be called, git clone the VVV project in the directory, then navigate to the directory using your terminal and type “vagrant up”. If you need to know about Vagrant VVV in detail you can visit their GitHub page with explains it thoroughly. After vagrant up, you get set of sites ready to go, for WordPress stable for WordPress trunk for trunk WordPress development files for the version of those development files built with Grunt for a default dashboard containing several useful tools

What we are interested in here is the trunk, so we get the latest version of the build for WordPress core. (I generally do a vagrant provision one again just to be sure I am on the latest build).

Once that is done, you can either test it for bugs or perform unit testing for the patch submitted

After you are ready with your development environment, go forward and make the changes you need to, test it until you get the perfect results. Refer the bug report for expected results.

After you get the expected result, Create a patch as described here.  On Linux you can simply do;

svn diff filename.php > filename.diff
svn diff > big_patch.diff
patch -p0 < patch.diff

If you are using git instead of svn, you may want to refer this.

Upload the patch file on the core trac . Change the status to has patch.

After you do this, other friendly people on the trac will review your patch.

WordPress Needs Core Contributor Mentors

WordPress would benefit from having a list of people that act as mentors for those contributing to WordPress for the first time via Trac. Drupal has gone through great lengths to make core contributing mentorship a priority. They have an entire site dedicated to mentoring new contributors. Even if it were not as organized as Drupal, I’d like to see a list of mentors I could get in touch with to walk me through the process of patching a bug or fixing a typo in core.

Contributing Was Awesome

Despite it only being a typo, contributing to the core of WordPress was exhilarating. Special thanks to Saurabh Shukla for answering a lot of question I had when creating the patch. The last thing I want to do on Trac makes the core WordPress developers job harder by improperly making tickets. Instead of screwing up, it’s better to not mess with Trac at all. At least that’s the way I’ve approached it.

While there is a handbook devoted entirely to contributing to WordPress, it’s not the same as being guided through the process with an experienced individual. Thankfully, most of the WordPress community is approachable and getting help is as easy as a tweet, or Slack, or emailing someone.

At the end of the day, I contributed to WordPress and you can too.

3 thoughts on “My first contribution to WordPress core; and how you can do the same.”

  1. Awesome post Swapnil. I don’t know anything about the WordPress and the patch you have contributed but reading this post really inspired me to get into WordPress development.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.