title: Wordpress REST API reading post meta but not updating
body: <p>I am trying to create a PowerApp in which I want to integrate the post meta fields. I inserted this code in the functions.php file. But I can read and write the data for default WordPress fields, but I am not able to update the post custom fields.  </p>
  
  <pre><code>add_action( 'rest_api_init', 'create_api_posts_meta_field' );
  
  function create_api_posts_meta_field() {
  
      // register_rest_field ( 'name-of-post-type', 'name-of-field-to-return', array-of-callbacks-and-schema() )
      register_rest_field( 'post', 'post-meta-fields', array(
             'get_callback'    =&gt; 'get_post_meta_for_api',
             'update_callback' =&gt; 'get_post_meta_update_for_api',
             'schema'          =&gt; null,
          )
      );
  }
  
  function get_post_meta_for_api( $object ) {
      //get the id of the post object array
      $post_id = $object['id'];
  
      //return the post meta
      return get_post_meta( $post_id );
  }
  
  function get_post_meta_update_for_api( $value, $object, $field_name ) {
      return update_post_meta( $object[ 'id' ], $field_name, $value );
  }
  </code></pre>