Embed a PDF or downloadable file in a post

MediaIntermediate~10 min

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. 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 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, 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, so the change is reversible. WordPress saves a revision on update, which means a download block in the wrong place is one restore away. 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 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. 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. It updates the post body through the normal editor path, so WordPress keeps a revision. If the download block is wrong, restore the previous revision.