Random Thoughts on the WP REST API and WordPress Core

I like sharing my random thoughts on subjects related to WordPress.  Right now, there is a lot of discussion about how to merge the WordPress REST API into WordPress core.  Here (in particular order) are my thoughts on the subject:

  • Merging the rest infrastructure if 4.4 was a great decision. Adding the ability to create rest end-points easily helps plugin developers. Adoption, as with any developer feature takes time and this one seems to be going swimingly.
  • While completely replacing wp-admin is certainly a long-term goal, the idea that it needs to be the next step for the API destracts from real issues in the endpoints that are close to being “finished”.
  • Password-protected posts suck. The core WordPress implementation sucks. Did you know that passwords are singular for the site?  If you have two password protected posts with different passwords, you can’t see the content of both at the same time. If they have the same password, you get both even if you were only supposed to have one. That said, they are something many users use and something the API needs to support to be included in core.
  • Meta is one of the most powerful features of WordPress.  Anyone remember how excited developers where to get term meta? You should, it was two months ago. Meta needs to be included in the API and ideally all of it.
  • The Fields API would really help solve some of the meta issues, but I think that also has a long ways to go before it’s something that can seriously be looked at for core.
  • Due to the fact that every WordPress site’s API is going to look a little different, clients for the API are going to have to be a “smart”.  This means they are going to have to consider getting both more data than they expected and less.  This is very different from a lot of other API clients where the response is consistent.
  • The “Four Core Endpoints” will enable a lot of awesome things. Iterating on revisions design just started. Imagine iterating on them with a solid API in WordPress core for posts. Imagine a completely new post editing screen that is built from the API. REST-driven themes will become a lot more feasible. Developers have been forced to forced to write custom code for these four data types for way to long.
  • Let’s get the four core endpoints to a state that they are done. To do that, we need to have some serious discussions about them. That isn’t going to happen while we debate creating endpoints for everything under the sun.

Jeremy Felt wrote some good thoughts on the REST API as well.  I didn’t read it until I wrote the majority of mine since I didn’t want his thoughts to cloud my judgement. Daniel Bachhuber is trying to collect feedback. You should write your thoughts as well.