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

Isolating PHPUnit tests to run

PHPUnit tests can be really slow, especially for large plugins that integrate with external APIs. It can be tempting thus to bypass the pre-commit hook via git commit –no-verify, but then Travis CI (or Bamboo) will eventually complain and the issue will come back to you, or worse the issue will get ignored. So we … Continue reading Isolating PHPUnit tests to run

PHP now upgraded to 5.6 in Quickstart

VIP just merged a PR which upgraded PHP to 5.6 in Quickstart. This is an upgrade from 5.4. With Quickstart being upgraded to 5.6, this should be a signal that we’re now in the clear to use any PHP 5.6 features (and 5.5 features) in our plugins. The first useful feature that comes to mind for us … Continue reading PHP now upgraded to 5.6 in Quickstart

PHP Code Beautifier and Fixer (phpcbf)

All of us PHP developers should be very well familiar with WordPress Coding Standards for PHP_CodeSniffer (phpcs). It automatically finds problems in WordPress code, both in terms of code style but also in terms of performance and security. It should be configured in your IDE and called in your repos’ pre-commit hooks. Did you also … Continue reading PHP Code Beautifier and Fixer (phpcbf)