Build better WP sites with Rest API

Since the release of WordPress 4.7, which was released in December 2016, Rest API has been included in WordPress. Without the need for any additional plugins. For developers, this brings a lot of new possibilities to create better WordPress sites.

If you’re unfamiliar with Rest API, take a look this article from Sitepoint before continuing this article.

Why use Rest API?

The first thing that comes to mind is speed. Even if you query the API with PHP, it is still a faster option compared to normal WordPress queries. And when you decide to ditch PHP and do it with JavaScript, the user experience rises to a new level. Nowadays there is a lot of competition for attention online since the users have an increasingly shorter attention span. Loading the whole page might cost you visitors, only load the content that needs to be loaded.

JavaScript takes over

With Javascript being most certainly the hot topic in both backend and frontend development, the WordPress Rest API most certainly opens new possibilities in both. Create your own admin dashboard or build your frontend with some modern javascript library (probably new one has been created while writing this article).

New possibilities

A lot of people have complained about the WordPress admin dashboard and most likely equally many continue to complain about it. Well, now it is possible to do something about it. Create a better one yourself. While it might be a rocky road, it is doable. Of course, there are benefits in the old familiar WordPress admin and this might be something you should consider.

Also, while PHP still is a powerhouse for most of the websites, there are other languages that have gained popularity in the recent years like Ruby and Python. Now you can easily integrate your WordPress with frameworks like Django.

It is customizable

You can easily extend it to fit your needs. Add more data to responses or create your own endpoints. Pretty much whatever you can think of.

Why still use WordPress?

While some aren’t liking the WordPress admin interface, some do. As a matter of fact, quite a few content writers are relatively familiar with the WordPress CMS. Because of this, it might be still businesswise smart to keep the familiar WordPress CMS in use and instead focus on creating something different in the frontend. If you don’t stuff your WordPress with plugins it is relatively ok CMS to use for simple stuff like articles.

WordPress Rest API in use

Casino Professor is an affiliate website that lists online casinos. Online casinos page is build using the WordPress Rest API and it provides a smooth user experience for the user looking for a place to play. Based on user input a simple jQuery function returns results quickly. Only the results that the user wants to see, instead of loading the whole page. User can sort casinos by categories, tags or use the search. All same things that normally require a page load in WordPress.

Casino Professor – Online casinos

via GIPHY

Get started

So what are you waiting for. Explore the Rest API handbook and start learning the new possibilities.