Skip to content

Instantly share code, notes, and snippets.

@tommymarshall
Forked from rileypaulsen/functions.php
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tommymarshall/460da59213239b76248c to your computer and use it in GitHub Desktop.
Save tommymarshall/460da59213239b76248c to your computer and use it in GitHub Desktop.
function wp_api_encode_acf($data,$post,$context){
$data['meta'] = array_merge($data['meta'],get_fields($post['ID']));
return $data;
}
if( function_exists('get_fields') ){
add_filter('json_prepare_post', 'wp_api_encode_acf', 10, 3);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment