Welcome to The Codingdom Blog where I share my ideas on working with the technology related to PHP, and a lot of other handy stuff.

Advertisements
Panel 1

Blog

To add a custom end point to the wp-rest api with the string param

To add a custom end point to the wp-rest api with the string param at the end. You can change the S+ with d+ for the integer param register_rest_route( ‘wp/v2’, ‘/data/(?P\S+)’, array( ‘methods’ => ‘GET’, ‘callback’ => ‘get_data’ ) ); function get_data($request){ $value = $request[‘data’]; //your code goes here } Ex: http://example.com/wp-json/wp/v2/data/test

Panel 2 Placeholder
Panel 3 Placeholder
Panel 4 Placeholder