Media commands
The bricks media commands manage your WordPress media library. Upload images and files without opening the browser, and search through what’s already there.
Upload a file
Section titled “Upload a file”bricks media upload <file>Uploads a file to the WordPress media library and returns the attachment details.
Example
Section titled “Example”bricks media upload hero-bg.jpgUploaded: hero-bg.jpg ID: 4521 URL: https://example.com/wp-content/uploads/2026/02/hero-bg.jpg Type: image/jpeg Size: 284 KB Dimensions: 1920x1080You can upload any file type that WordPress allows — images, PDFs, videos, SVGs (if your site has SVG support enabled).
Upload multiple files
Section titled “Upload multiple files”Run the command once per file:
bricks media upload photos/team-alice.jpgbricks media upload photos/team-bob.jpgbricks media upload photos/team-carol.jpgOr use a shell loop for a whole folder:
for f in photos/*.jpg; do bricks media upload "$f"; doneUploaded: team-alice.jpg (ID: 4522)Uploaded: team-bob.jpg (ID: 4523)Uploaded: team-carol.jpg (ID: 4524)List media
Section titled “List media”Browse what’s in the media library.
bricks media listID Filename Type Size Date4521 hero-bg.jpg image/jpeg 284 KB 2026-02-254520 logo-dark.svg image/svg 12 KB 2026-02-244518 product-screenshot.png image/png 156 KB 2026-02-234515 team-photo.jpg image/jpeg 320 KB 2026-02-204510 whitepaper.pdf application 1.2 MB 2026-02-18Search media
Section titled “Search media”Filter the list with a search query.
bricks media list --search "logo"ID Filename Type Size Date4520 logo-dark.svg image/svg 12 KB 2026-02-244492 logo-light.svg image/svg 11 KB 2026-02-104401 logo-icon.png image/png 8 KB 2026-01-15The search matches against filenames and titles in the media library.
| Flag | Description |
|---|---|
--search "<query>" | Filter media by filename or title |
Practical uses
Section titled “Practical uses”Upload a batch of images for a gallery page:
for f in gallery/*.jpg; do bricks media upload "$f"; doneFind the URL of an uploaded logo:
bricks media list --search "logo"Upload an image and reference it in HTML for conversion:
bricks media upload new-hero.jpg# Note the URL from the output, then use it in your HTML:# <img src="https://example.com/wp-content/uploads/2026/02/new-hero.jpg" alt="Hero">Related commands
Section titled “Related commands”bricks convert html— reference uploaded media URLs in your HTMLbricks search elements --type image— find image elements across your site