Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
function api_featured_images( $post ) {
$field = get_post_meta($post['id'], 'field_id', true);
return $field;
}
add_action('rest_api_init', function() {
register_rest_field( 'post, 'field_name', array(
'get_callback' => 'your_field_function'
));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.