0

Is there a way to get post metas via wp-api on request. I have a custom post_type having metas which I would like to receive on request but I do not see in docs any reference to this

fefe
  • 8,755
  • 27
  • 104
  • 180

2 Answers2

0

Here they are:

wp.getPost

Check that the parameters to getPost are:

int blog_id
string username
string password
int post_id
array fields: Optional. List of field or meta-field names to include in response.
Can Bican
  • 366
  • 5
  • 16
0

Post metas require authentication.

Other GET requests do require authentication though. For example, getting post revisions, getting users and getting post meta data require authentication

BTW the plugin will give you beta 12 (at the time of this answer) there are more options there than core's version.

You'll likely have to create an endpoint yourself for more advanced info. Here's a good example...

function register_user_meta_field() {
  register_rest_field( 'user',
    'meta',
    array(
      'get_callback'    => functionName '\\get_user_meta',
      'update_callback' => functionName . '\\set_user_meta',
      'schema'          => null,
    )
  );
}
Ben Racicot
  • 5,332
  • 12
  • 66
  • 130