参考:https://qiita.com/hisahayashi/items/1617bd0bd494da2a9049

Advanced Custom Fieldsを使用

add_action( 'rest_api_init', function () {
    $params = array(
        'get_callback'    => function($data, $field, $request, $type){
            if (function_exists('get_fields')) {
                return get_fields($data['id']);
            }
            return [];
            },
        'update_callback' => null,
        'schema'          => null,
    );
    register_api_field( 'page', 'fields', $params );
    register_api_field( 'post', 'fields', $params );
});

カスタムポストタイプを使用

add_action( 'init', function() {
    global $wp_post_types;

    // Add CPT slugs here
    $arr = ['<post-typeA>','<post-typeB>','<post-typeC>'];

    foreach( $arr as $key ) {

    // If the post type doesn't exist, skip it
    if( !$wp_post_types[$key] )
        continue;

        $wp_post_types[$key]->show_in_rest = true;
        $wp_post_types[$key]->rest_base = $key;
    }
});