Skip to content

Instantly share code, notes, and snippets.

@romuloctba
Created September 24, 2014 04:27
Show Gist options
  • Save romuloctba/a0e4cdc93cc2088da10e to your computer and use it in GitHub Desktop.
Save romuloctba/a0e4cdc93cc2088da10e to your computer and use it in GitHub Desktop.
Add Custom Fields from ACF to JSON REST API Wordpress functions.php
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 );
@romuloctba
Copy link
Author

Serve para adicionar os custom fields criados com o Advanced Custom Fields

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment