Blog

Why AI Writes Better TypeScript and How You Can Make PHP Play Along

AI writes TypeScript with calm confidence but feels far less predictable in PHP. After digging into why, I realised the difference had nothing to do with the model and everything to do with structure. TypeScript gives AI clear signals. PHP often gives it none. In this post, I break down why that matters and how you can bring that same clarity into PHP and WordPress today.

Why Code Reviews Break Down, and How to Bring Back Calm

On a long-running headless multisite project, our code review process slowly spiralled out of control, with 100+ open PRs, slow turnarounds, constant context-switching, and frustrated engineers. We fixed it by reframing how we think about reviews, creating a clear hierarchy, and making readability the foundation. This is the story of how we made code reviews calmer, faster, and far more...

Setting up and using Repress

In my last post, I discussed the general tech stack that I’ve been using lately for Headless WordPress builds. One of the main components of this stack is Repress. Repress is a small library written by Ryan McCue from Human Made that works with Redux and allows you to access your WordPress REST API data easily and with minimum fuss. It contains a number of higher-order components (HOC) that...

Headless WordPress and the REST API

Recently I’ve spent a fair amount of time building up React websites using WordPress as the data source. This has been a very interesting period of learning for me, coming from a PHP background and as such, I’m going to write down my thoughts on the process in the hope that it can help others approaching this task!  Why go headless? In my case, the reason for going headless was...

Google Maps Smooth Zoom

I was working on a project this week that required me to zoom in to a marker on a Google map. That’s easy, I thought, there must be a method for doing that within the V3 API. I was wrong. Apparently Google are fine with adding a panTo() method for smoothly panning to a marker, but the setZoom() method re-draws the map canvas and jumps straight to the zoom level you set.“ There are a...

CORS with the WP REST API and IE11

A bit of a background, I’ve recently been working on a reasonably large, headless, multilingual WordPress build. The frontend and the backend needed to be hosted on separate domains, so we decided to build this site using the following technologies: Backend: WordPress via the REST API JWT Authentication for the API WPML for i18n ACF Pro for custom fields. Frontend: React Redux i18next All...

How to properly include inline SVGs in a WordPress theme

SVGs are used all the time in WordPress themes and for a good reason, they are scalable, small in size and if we include them inline we can change colours etc without needing another image. There is one thing that bugs me when I see this though, especially with user uploaded SVGs; the way they’re included in the theme. There are 3 real ways that I’ve seen it done: Using...

Securing SVG Uploads in WordPress

This is from a talk I gave at WordCamp London 2018. Introduction These is briefly what I’m going to try and cover in this post. We’ll start with what an SVG actually is, moving on to the issues with SVGs on the web, why they’re dangerous and what dangers they present. I’ll then look at how we can sanitise them where we’ll cover some of the issues with sanitisation...