No featured media in API request

Question

when I make a request to http://localhost/wordpress/wp-json/wp/v2/posts/?_embed&categories=${categoryId}&per_page=${state.perPage}

I get the following result

[                                                                                                            
  {
    id: 3,
    date: '2019-04-20T16:10:00',
    date_gmt: '2019-04-20T16:10:00',
    guid: {
      rendered: 'http://localhost/wordpress/?p=3'
    },
    modified: '2019-04-20T16:36:30',
    modified_gmt: '2019-04-20T16:36:30',
    slug: 'slug-title',
    status: 'publish',
    type: 'post',
    link: 'http://localhost/wordpress/2019/04/20/slug-title/',
    title: {
      rendered: 'title'
    },
    content: {
      rendered: 'n<figure class="wp-block-image"><img ' +
        'src="http://localhost/wordpress/wp-content/uploads/2019/04/sirius.jpg" ' +
        'alt="" class="wp-image-4" ' +
        'srcset="http://localhost/wordpress/wp-content/uploads/2019/04/sirius.jpg ' +
        '370w, ' +
        'http://localhost/wordpress/wp-content/uploads/2019/04/sirius-217x300.jpg ' +
        '217w" sizes="(max-width: 370px) 100vw, 370px" ' +
        '/></figure>n',
      protected: false
    },
    excerpt: {
      rendered: '',
      protected: false
    },
    author: 1,
    featured_media: 0,
    comment_status: 'open',
    ping_status: 'open',
    sticky: false,
    template: '',
    format: 'standard',
    meta: [],
    categories: [
      3
    ],
    tags: [],
    _links: {
      self: [Array],
      collection: [Array],
      about: [Array],
      author: [Array],
      replies: [Array],
      'version-history': [Array],
      'predecessor-version': [Array],
      'wp:attachment': [Array],
      'wp:term': [Array],
      curies: [Array]
    },
    _embedded: {
      author: [Array],
      'wp:term': [Array]
    }
  }
]

But as you can see there is no featured_media. Do I have a misunderstanding about featured_media? I made my post with an image like you can see in content.rendered

0
evgeni fotia 2 months 0 Answers 16 views 0

Leave an answer