WordPress JSON Rest API Shortcode & Tutorial

They say you’re supposed to write with one specific person in mind, instead of writing for everyone. In this case, I’m writing for, well, me. Specifically, me before I spent about 4 hours hello-worlding the new WordPress JSON Rest API yesterday. I found the existing documentation to be a little too advanced or vague for my humble skill set. To that end, I’ve written a shortcode to bundle up what I learned and to help you hello-world it yourself:


It’s a plugin. Drop it in, activate it, try out the shortcode. You can pass it different values to test out different parts of the API. Read the comments to get a clear idea of what’s going on and get over the hump.

One thing in particular that I didn’t understand: I thought the docs on authentication were really vague, though admittedly it’s because this whole thing is a bit outside of my sweet spot. Turns out, if you send the request via javascript, the API will automatically grab your login cookie to do auth. There is nothing else required.