Last active
August 29, 2015 14:09
-
-
Save romuloctba/094ea5ec7c1f10954ae5 to your computer and use it in GitHub Desktop.
Add taxonomy images to WP-REST-API
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
<?php | |
//stuff... | |
function json_api_prepara_termo($data, $term, $context ) { | |
$termfield = get_field('arquivo_de_imagem', $term); //custom field inserido com plugin ACF | |
$data['customfields']['imagem'] = $termfield; //adiciona ele no array $data e o retorna | |
return $data; | |
} | |
add_filter( 'json_prepare_term', 'json_api_prepara_termo', 10, 3 ); | |
//nem precisa | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment