Last active
February 18, 2016 04:18
-
-
Save klihelp/a00d63fb11cf9d5bcc16 to your computer and use it in GitHub Desktop.
WP-API remove featured_image field
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 | |
/** | |
* Use with JSON_API_VERSION <= 1.1.1 | |
* Note: Include the action in your functions.php | |
*/ | |
/** | |
* Remove featured_image field from response | |
* @param object $data | |
* @return object | |
*/ | |
function kli_wp_api_remove_field_thumbnail_data( $data ){ | |
global $wp_json_media; | |
remove_filter( 'json_prepare_post', array( $wp_json_media, 'add_thumbnail_data' ), 10 , 3); | |
return $data; | |
} | |
add_action( 'json_prepare_post', 'kli_wp_api_remove_field_thumbnail_data', 5); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment