Answers for "wp rest api custom endpoints"

PHP
0

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',
  ) );
} );
Posted by: Guest on January-13-2021

Browse Popular Code Answers by Language