Created
November 10, 2017 16:28
-
-
Save jdcauley/942f6b75402670ceadc7b0196a4adfd2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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