Skip to content

Instantly share code, notes, and snippets.

@bacoords
Last active June 17, 2016 05:34
Show Gist options
  • Save bacoords/1ea0a0bcc0f8f1c91e1420a1dbdd277b to your computer and use it in GitHub Desktop.
Save bacoords/1ea0a0bcc0f8f1c91e1420a1dbdd277b to your computer and use it in GitHub Desktop.
//Register Meta with Rest API
add_action( 'rest_api_init', 'prefix_register_custom_meta' );
function prefix_register_custom_meta() {
register_rest_field(
'post',
'_prefix_url',
array(
'get_callback' => 'prefix_get_custom_meta',
'update_callback' => null,
'schema' => null,
)
);
register_rest_field(
'post',
'_prefix_email',
array(
'get_callback' => 'prefix_get_custom_meta',
'update_callback' => null,
'schema' => null,
)
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment