<?php | |
function ar_register_project_meta() { | |
register_api_field( | |
'project', | |
'meta', | |
array( | |
'get_callback' => 'ar_register_project_meta_get', | |
) | |
); | |
} | |
function ar_register_project_meta_get( $object, $field_name, $request ) { | |
return array( | |
'location' => get_post_meta( $object[ 'id' ], 'project_location', true ), | |
'thumbnail_image' => get_field('thubmnail_image', $object[ 'id'] ) | |
); | |
} | |
add_action( 'rest_api_init', 'ar_register_project_meta' ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment