Attach Featured Media to Post
A 3-step recipe with WordPress. We can help you get access.
Recipe · 3 steps
Attach Featured Media to Post
with WordPress
Select an existing image attachment and feature it on a new post.
- List image attachments from the media library, returning the most recent single image to use as the featured media.
- Create a published post and set its featured_media to the image attachment found in the media library.
- Read the post back by id to confirm it was created with the featured image assigned.
What you'll need to have ready
- authorization: HTTP Basic Authorization header value built from a WordPress Application Password (e.g. "Basic dXNlcjpwYXNzd29yZA==").
- postTitle: The title for the new post.
- postContent: The HTML content body for the new post.
For your developer
Arazzo workflow wordpress:attach-featured-media-to-post, 3 operations: listMedia → createPost → getPost. Specs on APIs.io.