wordpress rest api get posts code example
Example 1: wordpress get posts with meta data rest api
register_rest_field( 'post', 'metadata', array(
'get_callback' => function ( $data ) {
return get_post_meta( $data['id'], '', '' );
}, ));
Example 2: wordpress rest api get posts
ping http://yourdomain.com/wp-json/wp/v2/posts