Technical Notes on Contributing Code to WordPress Core

2 minute read

This morning I was contributing some code to WordPress trac. There are a few hard-to-remember-commands and hoops I currently need to jump through. Here they are so I remember for next time.
Context for anyone else who’s reading:

I placed the WordPress source files for build.wordpress-develop.test in ~/www/wordpress_develop/
(The first time I was setting it up, I needed to run the new npm and grunt build commands).
From there I run grunt patch:{ticketname} to apply a patch.
I run `grunt watch` to sync the files from `src` to `build` (btw, `build` is actually a symlink to `/srv/www/wordpress-develop/public_html/build` like I described.
To edit the files further, I use PHPStorm ability to open files over SSH (ie, the “Open Project from Existing Files” then select “Web server is on remote host, files are accessible via FTP/SFTP/FTPS”, and then because it’s a vagrant install, the domain is “localhost”, port 2222, and the default vagrant username and password: “vagrant”).
After editing files, I need to remember to select the files I want to upload to the vagrant server by right-clicking on the folder or files and select “Deployment” then “Upload…”.
I may need to double-check PHPStorm is using TABS like requested, and that comments end in periods and have proper punctuation, and there are blank lines between different PHPdoc parameters.
To create the patch for WordPress trac,

  1. I like to create a new branch,
  2. git checkout -b {ticket-number},
  3. then make a commit, git commit -am "message wont appear anywhere",
  4. then create the patch with git format-patch  -1 HEAD, which creates the patch file
  5. the move the file to a sync’d folder ` mv 0001-add-links-to-filter-sites-in-sites-list-table.patch /srv/www`
  6. and usually rename the file to just be the ticket’s number with an extra count in it, like `37392.1.patch`
  7. finally I upload the file to the ticket

Double-check that when I go back to working on an Event Espresso project, the code style in PHPstorm goes back to EE’s (I would think different projects would happily have different settings but that hasn’t happened for me yet).

Leave a Reply