# \[ADD DATA API] Thêm dữ liệu vào post (ok)

![](https://2370029328-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LWPtKFbhw0XehxVuoiZ%2F-MPc67mjdzcIg4QgcUby%2F-MPc6a8ttiYZdE-bUcs7%2FScreenshot_2.jpg?alt=media\&token=5703d7d0-a127-40c7-b736-88dfbf50aca8)

```
function post_featured_image_json( $data, $post, $context ) {
  $data->data['featured_image_url'] = wp_get_attachment_url(get_post_thumbnail_id($post->ID),'full');
  // $data->data['webbupointfinder_items_address'] = get_post_meta($post->ID);
  $data->data['webbupointfinderitemsaddress'] = get_post_meta($post->ID,'webbupointfinder_items_address');
  $data->data['webbupointfinderitemslocation'] = get_post_meta($post->ID,'webbupointfinder_items_location');
  $data->data['webbupointfinderitemfieldtelephone'] = get_post_meta($post->ID,'webbupointfinder_item_field_telephone');
  $data->data['webbupointfinderitemfieldmobile'] = get_post_meta($post->ID,'webbupointfinder_item_field_mobile');
  $data->data['webbupointfinderitemfieldemail'] = get_post_meta($post->ID,'webbupointfinder_item_field_email');
  $data->data['webbupointfinderitemfieldwebsite'] = get_post_meta($post->ID,'webbupointfinder_item_field_website');
  $data->data['webbupointfinderitemcustommarker'] = get_post_meta($post->ID,'webbupointfinder_item_custom_marker');
  $data->data['webbupointfinderitemheaderimage'] = get_post_meta($post->ID,'webbupointfinder_item_headerimage');
  $data->data['webbupointfinderitemsliderimage'] = get_post_meta($post->ID,'webbupointfinder_item_sliderimage');
  return $data;
}
add_filter( 'rest_prepare_post', 'post_featured_image_json', 10, 3 );
```

