Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action('rest_api_init', 'prayer_request_routes');
- function prayer_request_routes() {
- register_rest_route('prayerRequest/v1', '/{id}', array(
- 'methods' => 'GET',
- 'callback' => 'getPrayerRequestById'
- ));
- }
- function getPrayerRequestById() {
- global $wpdb;
- $id = $_GET['id'];
- $query = "SELECT * FROM wp_prayer_requests WHERE id = $id";
- $result = $wpdb->get_results($query);
- return $result;
- }
Add Comment
Please, Sign In to add comment