Register Rest Field

function joshcoast_custom_rest() {
	register_rest_field('post', 'authorName', array(
		'get_callback' => function() {
			return get_the_author();

add_action('rest_api_init', 'joshcoast_custom_rest');

This will put anything you want into the wp api call for a post, page, or any custom post type. Typically used in functions.php, but I’m guessing you could put it in a plugin too.

  1. The first arg is the post type
  2. The second arg is the key you want to use (can be anything)
  3. The third arg is the value, you can use a function to create it.