List media
wp_list_mediaList WordPress media library files newest first or by search relevance, with pagination and optional MIME-type filtering. Returns each attachment's ID, title, MIME type, URL, and date.
Instructions
List files in the media library (attachments), newest first, or by relevance when search is given. Returns items: [{id, title, mime, url, date}] and pagination {total, total_pages}. Only files with the usual status "inherit" are listed, so files set to private are not, and only those the account may read. No match gives an empty list. Needs upload_files. Read-only; wp_get_media returns one file with its sizes, alt text and caption.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mime | No | MIME type or its main part, e.g. "image", "image/png" or "application/pdf". Default: all types. | |
| page | No | Page number, starting at 1. Default 1. | |
| search | No | Search text, matched against title, caption and description. | |
| per_page | No | Files per page, 1–100; other values are clamped. Default 20. |