ACF for get_userinfo
-
Hi, i would like show acf in get_userinfo()
How i do this?In posts I inserted the code and it worked perfectly:
// FOR POSTS
add_filter(‘json_api_encode’, ‘json_api_encode_acf’);
function json_api_encode_acf($response) {
if (isset($response[‘posts’])) {
foreach ($response[‘posts’] as $post) {
json_api_add_acf($post); // Add specs to each post
}
} else if (isset($response[‘post’])) {
json_api_add_acf($response[‘post’]); // Add a specs property
}
return $response;
}
function json_api_add_acf(&$post){
$post->acf = get_fields($post->id);
}
// END POSTS
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘ACF for get_userinfo’ is closed to new replies.