WordPress REST API and AJAX

The WP REST API enables WordPress content and functionality to be used with AJAX, thus enabling code to be executed without a page refresh in WordPress or in Decoupled WordPress sites.

The workshop is a step by step set of progressive code tutorials that you can work with and keep that culminate in an AJAX form that posts data to a custom WP REST API endpoint that we will have created, which also has WP-NONCE verification as well.

Using the WP Rest API and AJAX, attendees will learn how to create WordPress Single Page Applications as well as  Decoupled WordPress sites to run on PHP or HTML pages.

The workshop has minimal JavaScript and JSON knowledge which will be explained as needed.

In this workshop we will look at:

  • What an API is and what makes it RESTful?
  • How to get and display content using the built in WP REST API.
  • How to create and validate JSON Web Tokens for authentication.
  • How to create our own endpoints in the WP REST API for both GET and POST requests.
  • How to create custom REST APIs using page-[slug].php
  • Create some WP pages that GET content, search content and POST form data with the added security check of using WP-NONCES.

To make the most of this workshop it would be good to have a code editor, local web server or a code editor with ‘live-server’.  Additional resources will be available to take away for later use.

Orateur·rice

Catégories