Created
September 24, 2014 04:27
-
-
Save romuloctba/a0e4cdc93cc2088da10e to your computer and use it in GitHub Desktop.
Add Custom Fields from ACF to JSON REST API Wordpress functions.php
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 json_api_prepare_post( $post_response, $post, $context ) { | |
$field = get_fields($post['ID']); | |
$post_response['custom-fields'] = $field; | |
return $post_response; | |
} | |
add_filter( 'json_prepare_post', 'json_api_prepare_post', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Serve para adicionar os custom fields criados com o Advanced Custom Fields