Slide 25
Slide 25 text
register_rest_route( 'rad/v1', 'site-info', array(
array(
'methods' => 'GET',
'callback' => function( $request ) {
return array(
'phone_number' => get_option( 'phone_number' ),
);
},
),
array(
'methods' => 'POST',
'callback' => function( $request ) {
update_option( 'phone_number', $request['phone_number'] );
return array(
'phone_number' => get_option( 'phone_number' ),
);
},
),
) );
`register_rest_route()` ΛͬͯΦϦδφϧAPIΛ࡞Δྫ