Category: WordPress

  • Repairing wp-env’s Testing Database

    Repairing wp-env’s Testing Database

    Sometimes when I interrupt PHP unit tests in a wp-env environment I end up getting the database in a bad state so that the next time I try to run tests I get: I then have to re-remember what I do to fix this every time, so I’m blogging it so I won’t have to…

  • Running the WordPress Plugin Directory Slurper

    Running the WordPress Plugin Directory Slurper

    As part of my work on the WordPress Core Performance Team, I need to do analyses on the plugins in the WordPress Plugin Directory. For example, in WordPress 6.3 we’re finally shipping first-party support for adding async and defer to scripts (a 13-year old ticket). In this case, the excellent WordPress Directory Searcher (WPdirectory) is…

  • Comparing Markup with PHPUnit

    Comparing Markup with PHPUnit

    For the upcoming WordPress 6.3 release, I’ve been contributing to the introduction of script loading strategies (i.e. the async and defer attributes). In the WP_Scripts class, all of the script tags are manually assembled with printf() & sprintf(), and as part of that work I wanted to start making use of helper functions that assemble…

  • Integrating with AMP Dev Mode in WordPress

    Integrating with AMP Dev Mode in WordPress

    tl;dr In v1.3 the AMP plugin for WordPress no longer has to remove the Admin Bar to keep pages valid AMP. The AMP plugin allows WordPress themes to be developed as usual and have their templates and stylesheets used to serve valid AMP pages. It does as much as possible to prevent serving invalid AMP…

  • AMP for JavaScripters

    AMP for JavaScripters

    Today at the JavaScript for WordPress Conference (#JSforWPConf), Felix Arntz and I gave a talk called AMP for JavaScripters about implementing interactive interfaces in AMP. Here’s the abstract we submitted for the talk: As we all know, adding JavaScript to a web page allows for dynamic page modifications. However, with that flexibility comes great responsibility:…

  • Using the AMP Plugin to Protect Site Visitors and Debug Security Vulnerabilities

    Using the AMP Plugin to Protect Site Visitors and Debug Security Vulnerabilities

    Case study in how the AMP plugin for WordPress revealed a security flaw in a popular plugin. Not only did the AMP plugin prevent the XSS vulnerability from being exploitable, but it also pinpointed the code responsible.

  • Creating Gutenberg Blocks without a Build Step via HTM

    Creating Gutenberg Blocks without a Build Step via HTM

    If you’ve ever looked into developing a block for the new WordPress editor (Gutenberg), you’ve seen that it’s recommended to code it up with JSX. Blocks are powered by React and the JSX syntax is significantly more readable and less verbose than the ES5-compatible syntax. For example, compare this ES5 code: With this equivalent in…

  • WordCamp Europe 2018 Recap: AMP and PWA

    WordCamp Europe 2018 Recap: AMP and PWA

    Recently I attended WCEU 2018 in Belgrade with quite a few colleagues from XWP. We were there in large part to promote the adoption of progressive technologies in WordPress. We spent a lot of our time at the Google booth where we had an area to talk about contributing to WordPress across a wide range of roles. I spent…

  • Remember Me Easter Egg

    Here’s a fun little easter egg to add to your WordPress login screen: make it so when you click the “Remember Me” checkbox that the song of the same name from Coco autoplays at the bottom of the login form: Here’s a quick and dirty plugin that does it: This file contains hidden or bidirectional Unicode…

  • “Building with JavaScript in the Customizer” at WCUS 2017

    At WordCamp US 2017 I gave a talk on “Building with JavaScript in the Customizer”. I was happy to have the opportunity to share the technical details on the Customizer’s architecture and JavaScript API, which saw many improvements in 4.9, in addition to being able to share the Customizer’s new user-facing features during State of the Word. The…