wordpress create REST Api

Example 1

Example 2 – Passing parameter

Example 3 – Passing multiple parameters

Example 3- permission check

 

$request in call back method is an object of ‘WP_REST_Request’ class this class contains methods like

get_header($key)

get_headers()

get_method()

etc.

we can call these methods with the help of $request  object eg:- $request->get_headers()

 

 

Ref: https://developer.wordpress.org/reference/functions/register_rest_route/

  Like
Author: bm on June 9, 2016
Category: wordpress

Your comment:

Your Name

Comment:




Last articles