Category: developers

  • register_meta(), register_rest_field() and the WP REST API

    There are two standard ways to add additional data into a post’s object in the WP REST API: register_meta() for post meta which is a string, number or boolean and register_rest_field()for everything else. There’s a bit on the difference between the two in the REST API docs. With Gutenberg, register_meta() is being used more widely and there’s…

  • Iterating over an array of objects which I desperately want to be reactive in Vue.js

    [a note to my future self from my current self as of 17 April 2018: are you here again? Is there definitely a unique key on that loop? Are you sure? GO PUT ONE ON NOW. Use the uuid package, it’s easy. Then come back if it still doesn’t work.] This took me a while yesterday…

  • “This block has been modified externally” notice of death in Gutenberg

    This notice drove me insane, especially because I couldn’t quite figure out what was being compared. It turns out it’s that the save function in registerBlockType() compares its return value to whatever is between the block’s html comment tags in the database.

  • The Mandelbrot set visualised in golang

    [note on 07 April 2018: I wrote this in late September 2017 but never published it. I think it’s not finished but useful up until that point so I’m publishing it now] This is a deeper dive into the Mandelbrot exercises in Chapter 3 of The Go Programming Language (Addison-Wesley Professional Computing Series) (that’s an affiliate…

  • Using Select2 with ajax with CMB2 repeating groups

    No idea if the title makes sense. I wanted a Select2 which uses a remote data source queried via ajax with a CMB2 repeating group so made a plugin to understand it better. It’s pretty heavily commented so I don’t forget why I did what I did. There are definitely a few if not many…

  • Using custom tables with CMB2

    This is more straightforward than I expected (yay thank you @jtsternberg). The short of it is to add a filter to cmb2_override_meta_value or cmb2_override_{$a[‘field_id’]}_meta_value to get the data and cmb2_override_meta_save to save it. But what if I have a repeatable group huh? What then?

  • Bulk deleting users in WordPress multisite

    So I have over 10,000 spam users and need to delete them1. The bulk delete in multisite only does 20 at a time and is somewhat slow so I wanted a better way to delete them all. This could be a massive mistake, if you are reading this because you need the same thing, you…

  • Setting up VVV v1 with SSL

    Even taking into stupid mistakes, this was fairly straightforward. Here’s how I set up my VVV local sites with SSL so I’m not screwed when I accidentally update Chrome. (It happens.)

  • Gutenberg identifiable but still non-global blocks

    I wanted to be able to add meta data to individual blocks, so needed a way of telling the blocks apart. What I’ve ended up doing is straightforward: each block gets a data-id attribute which contains the block’s uuid at time of creation.

  • Gutenberg wish list

    Ok, this is without really looking at it so maybe it has these. identifiable non-global blocks (so not these: https://github.com/WordPress/gutenberg/issues/2081) because I want to maybe use postmeta with a block? I don’t know, I have this vague idea that I’m too lazy to articulate atm. ok this wasn’t bad, I’ve done this. the ability to limit…