Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

wp custom rest endpoint

<?php
add_action( 'rest_api_init', function () {
  register_rest_route( 'myplugin/v1', '/author/(?P<id>d+)', array(
    'methods' => 'GET',
    'callback' => 'my_awesome_func',
  ) );
} );
Source by developer.wordpress.org #
 
PREVIOUS NEXT
Tagged: #wp #custom #rest #endpoint
ADD COMMENT
Topic
Name
6+7 =