The WordPress JSON Rest API (WP API): What It Is, How it Works, & What It Means For The Future of WordPress

Last Updated on September 20, 2022 by 23 Comments

The WordPress JSON Rest API (WP API): What It Is, How it Works, & What It Means For The Future of WordPress
Blog / Editorial / The WordPress JSON Rest API (WP API): What It Is, How it Works, & What It Means For The Future of WordPress

There is no denying that WordPress has an absolutely massive developer community, but the fact remains that the vast majority of WordPress users are not developers. This means that while developers, the ones who actually build WordPress itself as well as WordPress themes, plugins, and more are far better equipped to understand the evolution of WordPress and how its continued advancement will affect the whole WordPress ecosphere in the future.

I like to think that one of the primary purposes of a blog like this one is to help bridge the “understanding gap” that exists between groups like developers, power users, and regular users–at least in terms of broad stroke principles, ideas, and innovations. A good example being, the new WordPress JSON REST API and what its addition to core means for everyone no matter where they fall on the technical spectrum of WordPress users.

Over the last year or so there has been a lot of buzz about this new addition to WordPress and developers, on the whole, seem pretty excited about it. I believe for good reason, but what I don’t want is for everyone else to be left out of the fun. Or, for that matter, the brainstorming for how best it can be put to use.

That’s why in this post I’d like to walk you through the basic ideas behind the WordPress JSON REST API technology and describe what some developers are already doing with it. I will also explain what else is possible with it and hopefully inspire some of you to use it in still more interesting, unexplored ways.

To get started, let’s clarify some key terms.

What Is An API?

An API or Application Programming Interface is a software intermediary that allows programs to interact with each other and share data in limited, clearly defined ways.

A few good examples of APIs in action would be:

1. Anytime an app uses Google Maps to display its location information.

2. A mobile or desktop twitter client.

3. A game/service that integrates Facebook features such as login, messaging, etc.

In these instances, and all others like them, the APIs “expose” certain internal functions of the primary applications so that outside developers can use them in their own applications or websites. In these examples, app developers have been given the ability to tap into the powerful features (and/or content) of major web services so that they can build on top of them and/or integrate key content and features into their own products. But again, only in limited, clearly defined ways. This allows a form of open collaboration to walk hand in hand with security.

What Is A REST API?

REST stands for REpresentational State Transfer. It is an architectural style of building APIs; not a code language or description of its function. A REST API is designed to provide a lightweight form of communication (less bandwidth) between producer (ex: Twitter) and consumer (ex: Twitter client), making it a great solution for high volume web services like Google Apps, Facebook, Twitter, and now WordPress.

What Is The WordPress JSON REST API (WP API) & How Does It Work?

JSON, which stands for JavaScript Object Notation, is a lightweight data-interchange format based on a subset of the JavaScript code language. It’s easy for humans to read and write and easy for machines to parse and generate. Which also makes it a great fit for creating REST APIs–such as the new WordPress JSON REST API or WP API as it has been named.

JSON is the notation, REST is the architectural style, and API is the interface they make up. When you put them all together you get a tool that developers can use to easily share data from their WordPress website(s) to other websites or applications.

More specifically, the WP API allows you to take CRUD actions on WordPress content. Which means Create, Read, Update, and Delete the following content types:

  • Posts
  • Pages
  • Custom Post Types
  • Media
  • Comments
  • Taxonomies
  • Users
  • Or any other type of content you can extend it for…

To get a better idea of why someone might want to do that in the first place, it helps to look at some use cases that show the benefits of these capabilities.

How Has the WP API Been Used Already?

With the WP API part of core and available to all WordPress users, the value associated with using it in innovative ways has increased exponentially. So far though, from what I’ve personally seen and read, there are certain obvious use cases that seem to be dominating at the moment.

For instance, you can use the WP API to improve just about any existing WordPress functionality that is JavaScript based, such as:

  • backbone.js thems or plugins
  • populating infinite scrolls
  • form validation/submission
  • front-end content editing

You can also:

  • display content from another site within a multisite network
  • display content from a separate WordPress site
  • create or update content on a separate WordPress site or another site within a multisite network

These are all extremely valuable use cases that both solve existing issues and add new creative possibilities. However, what I’m most excited to see happening in the future are some of the potential use cases below.

What Are Some Other Potential Use Cases for the WP API?

For me, one of the coolest aspects of the WP API is that it allows you to break your content free from WordPress completely. Giving WordPress users an unprecedented amount of control over how their content is experienced.

There are a few ways one might choose to do this:

Displaying and managing your content within a mobile/desktop application (that is not the official WordPress App).

For me, this one is huge. It opens up a ton of possibilities for content creators and consumers alike. Content creators might begin to see a new and better crop of mobile/desktop blogging clients that allow them to create blog posts and more in unique environments that could never be built in the backend of WordPress itself. Likewise, there could be whole new content experiences built on the web or mobile apps using programs that function completely differently than WordPress but that get its content from a WordPress site.

Integrating your content with other application platforms.

There may be application platforms that are not built on PHP or any code language used in WordPress that nevertheless are able to seamlessly interact with your content. I could see some sort of aggregation tool that allows people to quickly and easily connect their blog and add content via tags or categories. Or something completely different! Literally the only limit is how you can think to creatively manipulate the wide ranging CRUD actions we talked about above.

Integrating other application platforms with your WordPress site.

This one is basically the inverse of the last use case. It’s important to point out on its own though nonetheless. This could allow you to have a very wide array of content sources all feeding into one WordPress site and then displayed just the way you want it.

What Does The WP API Mean for the Future of WordPress?

In a nutshell, what the WP API means for the future of WordPress is that it is one solid step closer to becoming a fully fledged application platform. How we put it to use will be one of many key determining factors in how quickly and in what fashion that becomes a reality. Personally though, I’m not worried about whether or not WordPress is classified as one thing or the other, I’m just excited about new possibilities.

For instance, I would love to have some of my favorite writing, video editing, and graphics programs able to publish directly into WordPress. I can imagine a dozen amazing things you could do–from theming to storytelling to “simple” article publishing–that this new API makes possible. Now we just have to work together as a community to build it all!

Recommended WP API Resources

If you’re interested in learning more about the WP API and what you might be able to do with it, I would recommend taking a look at the following resources:

In Conclusion

WordPress, as always, is growing and changing to continue to meet the demands of its community. Adding WP API to core is one of the biggest and most exciting ways it has done this in quite some time. I know I am personally very excited to see what others decide to do with it and I’d love to find groups to collaborate on my own ideas with. What about you though? Are you excited about the WP API? Do you at least feel like you understand it now? Please take a minute or two to share your thoughts with the whole community in the comments section below.

Article Thumbnail via Imagentle // shutterstock.com

Divi

Want To Build Better WordPress Websites? Start Here! 👇

Take the first step towards a better website.

Get Started
Divi
Premade Layouts

Check Out These Related Posts

Get a Free Wedding Invitation Layout Pack for Divi

Get a Free Wedding Invitation Layout Pack for Divi

Updated on March 13, 2023 in Divi Resources

Hey Divi Nation! Thanks for joining us for the next installment of our weekly Divi Design Initiative; where each week, we give away a brand new Layout Pack for Divi. This time around, the design team has created a beautiful Wedding Invitation Layout Pack that’ll help you get your next Wedding...

View Full Post
What is WordPress VIP (And Who Is It For)?

What is WordPress VIP (And Who Is It For)?

Updated on April 26, 2023 in Editorial

People who need more power for their sites tend to avoid WordPress.com in favor of self-hosted WordPress. However, the former actually happens to offer one of the most exclusive hosting services for websites that require a bit more punch, called WordPress VIP. This particular hosting service is...

View Full Post

23 Comments

  1. NATHAN

    I am a blogger with three standalone WordPress sites. Each site has identical themes and plugins. I have little grasp of the technical side of WordPress things.

    So, what benefit would I derive from adding the JSON REST API (WP API) plugin to my sites?

    Thanks in advance,

    NEAL

  2. thank you for sharing, iam new in tutorial wordpress api json. but this article is very help me for learn about wordpress api json. because i want a android app for my website..

  3. I was wondering if you can give me some direction perhaps. I have installed a multi-site WP where I’m planing on installing different eCommerce themes. I like to create a centralized theme so I can bring all functionalities of those themes into one. So, the front-end (centralized theme) will be what users interact with. Any guidance will greatly be appreciated.

  4. you mention a couple times that this is merged into core but documentation points to a plugin, https://wordpress.org/plugins/json-rest-api/ Did this already become a part of core? what version was it merged in?

  5. This is a great (new) world to WordPress. I think it’s the right way to open new possibilities but keeping the GREAT and easy to use WP backend admin that so many people like and are used to.
    I wish I knew a way to cache the json info to a separate IAAS provider like Firebase for example, so the requests can be scaled acordingly. Does anybody know some stack like that?

  6. You know what excites me the most? The fact that you’ll be able to create single page Javascript applications ( such as React ) on top of the software that we all know and love.

    This means that if you’re a front end developer who knows WordPress, you won’t have to deal woth backend stuff as much for data retrieval; You’ll be able to focus on the front end almost 100% of time, while till having your backend covered. This amazes me.

  7. I have used this API to Phonegap, I’m starting to learn. But I have a dúdiva: I can not chmar et-pb-post-main-image-fullwidth. Why?

  8. I love where this is going and I would love the idea of using apps for WordPress CRUD and even the Photoshop integration. I bet this is just the very beginning of what WordPress will eventually turn into. I have very high hopes and I love any positive changes. I can’t wait to learn more about it and using the WP API myself. If there are any good tutorials now, or in the future, please post them!

  9. Hello Nathan,I want to give you a special thanks because you just open a new world for me.This article is very useful and exceptional.the link which you added was really very helpful.keep it up.double thumbs up for you.But one thing I want to know,Is WP REST API is fully secure?

  10. Great article and thanks for the additional resource links. Do you or anyone else reading know of any WP testimonial plugin whose data would be accessible via the API ?

  11. Nathan,
    I just wanted to Thank you for you contribution here. It’s people like you who make a difference for our community. Keep up the great work. You’ll be blessed for being selfless, and thinking of others.

    P.S. If you’re reading this and you still haven’t at least invested in the Elegant Themes Annual Subscription to try the best website building software on the market, make the decision to join the Elegant Themes Family of Website Designers today. You won’t regret making the right decision.

    R. Trevino

  12. Sounds like I’ve got some serious learning coming up.

  13. I read about it the other day but your post clarifies many things and stimulate instant interest but how secure can this WP REST API be?

    Regards

    • I’m not a security expert but given the wide use of REST APIs I’m fairly certain they’re safe. I’m curious to learn more about this area as well.

  14. Do you have any examples on how to use it?

  15. Is there any video that can tell us more, or give us teachings?

  16. Fantastic, perfect… this opens a whole new world!

  17. So it means that different WP instances (Multisite) can have an easy access to a registered users database?

    I mean a company XYZ has 2 WP installs, one is business website/blog/etc and the other is a shop. And when user registers in one, can automatically have access to the other (if that functions is inroduced and enabled by developers).

    Does it make any sense?

    • Michal,

      Whilst you could use the wp Api to do that it would be much easier to do this with Multisite via a plugin. Multisite already has a shared user database so it’s just a matter or copying the roles of variance users between sites.
      If you need a simple plugin to achieve this I can assist.

  18. This is pretty huge, the kind of flexibility being opened up by having an API available is endless. Although, this does mean that there is a lot of studying in my future.

    • Bronson, if you’re looking for further reason on the matter, you might find this interesting https://css-tricks.com/thoughts-on-an-api-first-wordpress/

      It was something I read the other day, but didn’t fully grasp at the time, because I needed a post like this one by Nathan to give me the basics, but I think it helps show more about how this would all work, and how it really does open up WordPress to sooooo many more possibilities.

      V exciting stuff!!

  19. Thanks so much for taking the time to put this together Nathan.

    I’ve seen a lot of articles around the web talking about this, but has zero clue what it was, what it means, etc, so I just avoided those articles!

    Now with a bit more of a basic understanding I can dive into them!

    You did exactly what you set out to do, bridged the “understanding gap” for someone like me.

    Again, thanks, very much appreciated.

Leave A Reply

Comments are reviewed and must adhere to our comments policy.

Get Started With Divi