Embed a PDF or downloadable file in a post

MediaIntermediate~10 minUpdated

Before you start

A connected site with content writes on and the upload-media and update-post abilities enabled. The upload ability handles images only (jpg, png, gif, webp), so add the PDF or file to your Media Library yourself and give the agent its URL. The update sends the whole post body in one call, so the agent reads the raw block markup first and pastes the original body into the chat before it writes. Have a preview image ready if you want a thumbnail.

Adding a downloadable file to a post is fiddly to do well by hand: you upload the file, copy its URL, drop in a button, write a label, maybe add a cover thumbnail, and get the whole thing sitting in the right spot without breaking the layout. It is five minutes of clicking for something that should take one.

This prompt does the wiring. You put the file in the Media Library yourself, hand the agent its URL, and the agent reads the post, uploads a preview image if you want one, and drops in a clean, labelled download. Nothing saves until you approve it.

The prompt
I want to add a download for [the 2026 price list PDF] to [the Pricing post,
id 88]. The file is already in my Media Library at [https://example.com/...].
Read the post first, as raw block markup, and find a sensible spot near the top for
the download.
I am giving you a preview image at [path/to/cover.png], upload that into the
Media Library and use it as a clickable thumbnail that links to the file URL,
with a clear "Download the price list" label beside it.
Show me the block before you save anything. Once I approve, paste the post's
current body into your reply so I have a copy, then update the post and hand it
back so I can check how the download looks.

Why this is safe to run

Reading the post comes first and changes nothing, so the agent knows where the download belongs before it touches the body. One honest limit sits at the center of this recipe: the upload ability handles images only, so the agent cannot upload the PDF or file itself. You add that to your Media Library, and the agent works from the URL you give it. The only thing it uploads is the preview image you hand over.

The write half edits the post body through the normal editor path, and the agent puts the original body in the chat first, so a download block in the wrong place is easy to take back. The post edit is recorded in the Changes tab and can be reverted there if the post has had no other edits. The image upload is not recorded, so delete it from the Media Library yourself if you drop the idea. On top of that, the write abilities stay off until you enable them, every call is checked against the capability of the user you bound the agent to, and the edit is shown to you before it saves and logged in the Activity Log after.

Already connected? Skip the paste. Ask your agent for the “embed a PDF or downloadable file” recipe, give it the file URL and the post, and it wires up the download on your own site.

How it works

  1. Read the post you name as raw block markup so the agent sees where the download should sit.
  2. Upload the preview image you provide, if you want a clickable thumbnail.
  3. Draft a labelled download button or link that points at your file URL.
  4. Show you the change and wait for your approval before it saves.
  5. Paste the current body into the chat so you have a copy, save the approved edit, and hand back the updated post for review.

Questions

Can the agent upload the PDF itself?
No. The upload ability accepts images only (jpg, png, gif, webp). Add the PDF or file to your Media Library yourself, then give the agent its URL and it wires up the download link.
Is the edit reversible?
Yes. The agent pastes the original post body into the chat before it writes, so you can put it back. The Changes tab in wp-admin can revert the post edit as well, if nobody has edited the post since. The preview image upload cannot be undone.