Created
May 19, 2018 19:53
-
-
Save robertdevore/ddea5ff761117e900549becd99e6c3c5 to your computer and use it in GitHub Desktop.
The current way WP Dispensary adds in the custom flowers_category taxonomy to the Flowers REST API endpoint
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 | |
| /** | |
| * Add Category taxonomy for the Flowers Custom Post Type | |
| */ | |
| function flowers_category( $data, $post, $request ) { | |
| $_data = $data->data; | |
| $_data['flowers_category'] = get_the_term_list( $post->ID, 'flowers_category', '', ' ', '' ); | |
| $data->data = $_data; | |
| return $data; | |
| } | |
| add_filter( 'rest_prepare_flowers', 'flowers_category', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment