Created
April 23, 2022 22:22
-
-
Save wolfcoder/f6896ce10da7a0ae29ae4fbe857a7796 to your computer and use it in GitHub Desktop.
This file contains 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 wpenginer_custom_rest(){ | |
register_rest_field('post', 'authorName', array( | |
'get_callback' => function() {return get_the_author();} | |
)); | |
} | |
add_action('rest_api_init', 'wpenginer_custom_rest'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment