Last active
March 21, 2017 19:30
-
-
Save ellefsen/aa21755248389a3c96ecfae02136025f to your computer and use it in GitHub Desktop.
Add ACF fields to WordPress Page Meta 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 | |
/** | |
* Add ACF to Post meta stuff. | |
*/ | |
function my_rest_prepare_post( $data, $post, $request ) { | |
$data->data['meta'] = array_merge($data->data['meta'], get_fields($post->ID)); | |
return $data; | |
} | |
add_filter( 'rest_prepare_page', 'my_rest_prepare_post', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment