Skip to navigation
Example of a get restful api with wordpress
21.10.19
function bwc_register_route() { //http://127.0.0.1/wp-json/bwc/v1/pdf/5 register_rest_route( 'bwc/v1', '/pdf/(?P
\d+)',[ 'methods' => WP_REST_Server::READABLE, 'callback' => 'bwc_get_pdf', ]); } add_action( 'rest_api_init', 'bwc_register_route' ); function bwc_get_pdf( $request ) { $data = ['your_reqeust'=> $request['id']]; return rest_ensure_response( $data ); }
https://developer.wordpress.org/rest-api/
Reply
Anonymous
Information Epoch 1746005852
There is no perfect productivity system.
Home
Notebook
Contact us