Book Image

Learning WordPress REST API

By : Sufyan bin Uzayr, Mathew Rooney
Book Image

Learning WordPress REST API

By: Sufyan bin Uzayr, Mathew Rooney

Overview of this book

The WordPress REST API is a recent innovation that has the potential to unlock several new opportunities for WordPress developers. It can help you integrate with technologies outside of WordPress, as well as offer great flexibility when developing themes and plugins for WordPress. As such, the REST API can make developers’ lives easier. The book begins by covering the basics of the REST API and how it can be used along with WordPress. Learn how the REST API interacts with WordPress, allowing you to copy posts and modify post metadata. Move on to get an understanding of taxonomies and user roles are in WordPress and how to use them with the WordPress REST API. Next, find out how to edit and process forms with AJAX and how to create custom routes and functions. You will create a fully-functional single page web app using a WordPress site and the REST API. Lastly, you will see how to deal with the REST API in future versions and will use it to interact it with third-party services. By the end of the book, you will be able to work with the WordPress REST API to build web applications.
Table of Contents (16 chapters)
Learning WordPress REST API
Credits
About the Authors
Acknowledgments
About the Reviewer
www.PacktPub.com
Preface

Steps to disable the default routes


The WordPress REST API provides a set of standard routes, but they might not all be required for your app, as the default routes were not all specifically designed for it. The REST API will make it simple to add custom endpoints that will have absolutely no limit on how they will be used. In our next chapter, we will be covering the process of creating custom routes that, for application development, will work better than using the usual default routes method.

  • When working with default routes, you should be careful about doing so as that will be counted on several third-party tools.

  • There is a possibility that the WordPress admin will start utilizing the REST API, which will remove the default routes and will break the admin.

  • The registration of default routes will be removed, which, by getting rid of the hook where the endpoints, in a manner similar to following code:

remove_action( 'rest_api_init', 'create_initial_rest_routes', 0 ); 

Another technical...