My Struggle to Learn How the WordPress REST API Works

Earlier today, I watched a free presentation on how to use the WordPress REST API by Rachael Baker via WPSessions. If you missed it, you can watch the recording for $9.

As I watched the presentation, it was clear that no matter how many tutorials I read, WordCamp sessions I attend, and videos I watch, I won’t be able to grasp the API until I use products built with it. I’m not a developer and the REST API is developer centric technology.

What I Think the REST API Is

Based on what I’ve learned so far, I’ve figured out that the API provides a series of end points which are specific parts of WordPress. These end points can be connected to and manipulated through the REST API.

It’s this API that opens up a slew of new opportunities for application developers to send and receive data. This is what allows a developer to build an app that connects to WordPress with minimal code.

Learning Custom Post Types

In 2010, there were a lot of requests for tutorials on how to give specific posts a unique style. When Custom Post Types were introduced in WordPress 3.0, I was excited because I thought they would provide the ability to create custom styles for posts.

Looking back, some of the requests are due to the post_class() function added in WordPress 2.7 that provides the ability to use CSS to style a post. It took a few years to rewire my brain to not think of Custom Post Types this way.

When I described how long it took to figure out Custom Post Types on Twitter, Justin Tadlock responded, that end users should have never been introduced to the term post type.

@jeffr0 End users should've never heard the term "post type". We devs did a poor job with that. We should've said "forums," "e-commerce,"…

— Justin Tadlock (@justintadlock) May 26, 2015

Reviewing Products Helps Connect the Dots

I didn’t fully comprehend Custom Post Types until I reviewed several WordPress products that utilized them. After awhile, I was able to connect the dots between what I saw in the WordPress backend and what appeared on the front end.

I think the same thing will happen when the REST API is added to WordPress core. I’ll be able to connect the dots and figure out how it works by reviewing products that use it.