How to get custom post meta using REST API
$post in the callback function is an array, not an object. So you cannot use $post->id. Change it to $post[‘id’] and it should work: function slug_get_phone_number($post, $field_name, $request) { return get_post_meta($post[‘id’], ‘_phone’, true); } I recommend to change _phone to phone_number or something else without underscore prefix. Because _ is often used with private meta … Read more