Sanity check pre-commit hook for SVN

When committing to SVN, “there is no reset button”. You cannot purge the memory of a commit once it has been made in an SVN repo (e.g. a theme on WordPress.com VIP, a plugin in the WordPress.org directory, or even especially WordPress core at develop.svn.wordpress.org). That is, in SVN there is no commit amending, hard … Continue reading Sanity check pre-commit hook for SVN

Git pre-commit hook for WordPress development

As seen previously on this blog, in Contributing to WordPress Core via GitHub and Streamlining Contributions to WordPress Core via GitHub, there are instructions for how to get a Git repo set up for committing patches for WordPress Core. These posts also include instructions for how to set up Travis CI to restrict reporting linting errors to just the scope of the changed lines … Continue reading Git pre-commit hook for WordPress development

Bridging the Customizer and the WP REST API

Update 2017-01-03: This post and associated plugins have been updated for WordPress 4.7. There’s a lot of excitement in the WordPress community about the WP REST API. We’ll be sending a couple representatives to the Day of REST conference coming up at the end of January, and I’ve been long-overdue to do a deep-dive in to the REST … Continue reading Bridging the Customizer and the WP REST API

The Impact of the Customizer at WCPDX

A couple months ago at WordCamp Portland, I gave a talk on “The Impact of the Customizer”: The Customizer is WordPress’s framework for live previewing changes to a site. Live preview gives confidence to those who would otherwise lack it when making a change: it gives freedom to experiment and explore, without a negative “save … Continue reading The Impact of the Customizer at WCPDX

Implementing Selective Refresh in the Customizer

To make the Customizer a great user experience, themes and plugins should implement settings that use the postMessage transport as much as possible. By default, settings get registered with a refresh transport meaning that every change to that setting will trigger a refresh in the preview so that PHP can re-render the preview with the … Continue reading Implementing Selective Refresh in the Customizer

Streamlining Contributions to WordPress Core via GitHub

In Contributing to WordPress Core via GitHub, I detailed the somewhat-tedious workflow that I’ve been using for developing and collaborating on patches that get manually uploaded to Trac. Now that the topic of using GitHub for Core contributions is again up for discussion at the WordPress Community Summit, I wanted to jot down some ideas for … Continue reading Streamlining Contributions to WordPress Core via GitHub

Musings on Customizer as Future Admin Interface

There has been a lot of (well-deserved) excitement over Automattic’s Calypso project which largely re-implements the WP admin on WordPress.com as a JavaScript-driven REST API-powered single page application. (Reminder: WordPress.com is a service of Automattic that is built on the WordPress project, which I’ll call “WordPress.org” to differentiate here.) It is great to see what … Continue reading Musings on Customizer as Future Admin Interface

Use meta_input and tax_input with wp_insert_post() & wp_update_post()

We were recently in a situation in a project where we wanted to rebuild/invalidate a cache when a particular post was updated. Some of the key data for the post is stored in postmeta. So we have code that looks like: The problem here is that we can’t reliably use the save_post action to flush the cache because … Continue reading Use meta_input and tax_input with wp_insert_post() & wp_update_post()

Contributing to WordPress Core via GitHub

As announced at the beginning of last year (2014), there are official Git mirrors of WordPress core development SVN repo. This was a huge win because SVN is painful. Unfortunately, however, this Git repo mirror at develop.git.wordpress.org is not the same one that appears as the (apparent) official WordPress repo on GitHub. This GitHub repo is actually a mirror (ish) of the (legacy) core.svn.wordpress.org SVN repo which does not include the unit tests or other tools needed for development: it is a build repo. For more information, see A New Frontier for Core Development.

Continue reading Contributing to WordPress Core via GitHub

Automatically finding code reviewer candidates

Let’s say you’ve made a change to functions.php and config.php in some theme. Who do you assign to code review the changes? One handy way is to use git shortlog -sn. Here’s how to get the top 5 candidates for reviewing a change: $ git shortlog -sn functions.php config.php | head -n5 15 Piotr Delawski … Continue reading Automatically finding code reviewer candidates