Search code examples
wp-api

How can I add attachments to a post with WP-API


I am creating posts with WP-API and I want to attach files to them.

I see a section in the docs saying "create an attachment", but it seems that it doesn't associate the file with a post.

I also don't see any other obvious way to associate a media/attachment with a post.

What am I missing?


Solution

  • It seems that WordPress (or WP-API) does not link media to posts, but you have to add a link on your post to the media/attachment.