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.
I think the rest API will really start to show for end users when you start seeing a lot of themes use it for headless WP. I wouldn’t be surprised if WP admin starts using this as well (much more so than it does now). You’ll start to see a lot more interactive parts of the site that don’t require a page refresh, that refresh data automatically, that keep you very connected to the site.
I do have to disagree on the sentiment that end users should have never been exposed to the term “custom post type.” I don’t think it was helpful to use the term “post,” as something like “custom content type” would be much more accurate and less confusing. However, I always try and educate clients on how things work behind the scene, as it can sometimes help them see why some tasks take as many hours as they do as well as help them know what I as the developer have to work with. Not all of them want those details, but I find the ones that do have much less stress and feel more pride in their site. :)