From the course: WordPress: REST API

What is the WordPress REST API? - WordPress Tutorial

From the course: WordPress: REST API

Start my 1-month free trial

What is the WordPress REST API?

- [Instructor] The WordPress REST API, sometimes referred to as the WP-API, became a core feature of WordPress in version 4.7 in December 2016 and has since then become one of the core building blocks of WordPress itself. So what is this REST API and what can it do? Here's the elevator pitch. The WordPress REST API changes how we think about and work with data managed by WordPress. It provided complete separation between the content of a site and its presentation by allowing any client to interact with the data, even outside of WordPress. In it's most concise definition, the WordPress REST API is a RESTful API that uses simple HTTP requests to access the data of a WordPress site in JSON format. That's quite a mouthful so here's the English translation. The WordPress REST API is a new way of accessing the data WordPress provides, without having to go through a theme or an RSS feed or XML-RPC. And when I say accessing, I don't just mean getting the data to read. With the REST API, you are able to create, read, update, and delete content in the WordPress database without interacting with WordPress directly. And this opens up a whole new world of opportunities. You see, up until now, if you wanted to read a WordPress post or page, you had to use a WordPress query in PHP, typically through a WordPress theme. The theme would use the WordPress templating engine and hierarchy to output the post or page or whatever other content you requested through the address bar in your browser. This setup has severe limitations. If for example, you wanted the content from your WordPress site to appear in a mobile app, you'd have to either build a custom PHP application to do that or pass the data through an antiquated protocol. The WordPress REST API gives us direct access to the data and allows us to do whatever we want with it. And that's just the tip of the iceberg. The WordPress REST API also allows us to access and edit the data in the database without going through WordPress Admin, if you have the right access credentials and capabilities, of course. This means we can now build new interfaces for creating content with WordPress. Just think about that for a minute. WordPress without the WordPress Admin panel. In this course, you'll build a foundational understanding of the WordPress REST API, what it is, how it works and how we interact with it. We'll spend some time digging into the details of the API to understand its structure, modify what information the REST API can provide to us and I'll give you some practical examples and showcase how to interact with the REST API and access and edit content.

Contents