WordPress - Upload Media
Description
Section titled “Description”This module allows uploading files to the WordPress media library from a public URL. Supports images, videos, PDF, and other formats. The file is downloaded from the provided URL and automatically uploaded to WordPress.
Configuration
Section titled “Configuration”Credentials
Section titled “Credentials”| Field | Description | Example |
|---|---|---|
url | WordPress site base URL | https://my-site.com |
username | WordPress username | admin |
application_password | Application password generated in WordPress | xxxx xxxx xxxx xxxx |
Parameters
Section titled “Parameters”| Field | Type | Required | Description |
|---|---|---|---|
| credentials_id | credentials | Yes | WordPress credential |
| file_url | text | Yes | Public URL of the file to upload |
| title | text | No | File title in the library |
| alt_text | text | No | Alternative text (SEO/accessibility) |
| caption | text | No | Caption or photo description |
| description | textarea | No | Detailed description |
Output
Section titled “Output”{ "success": true, "media_id": 789, "media_url": "https://misitio.com/wp-content/uploads/2025/01/imagen.jpg", "media": { "id": 789, "title": { "rendered": "Mi Imagen" }, "source_url": "..." }, "message": "File uploaded successfully"}Usage Example
Section titled “Usage Example”Upload image with title and alt text
Section titled “Upload image with title and alt text”{ "file_url": "https://ejemplo.com/imagen.jpg", "title": "Main Banner", "alt_text": "Main page banner with promotion"}Upload PDF
Section titled “Upload PDF”{ "file_url": "https://ejemplo.com/documento.pdf", "title": "2024 Catalog", "description": "Updated product catalog"}API Used
Section titled “API Used”- Endpoint:
POST /wp-json/wp/v2/media - Documentation: WordPress REST API - Media
- The file is downloaded from the provided URL and uploaded to WordPress.
- Supported formats: JPG, PNG, GIF, PDF, MP4, etc. (depends on WordPress configuration).
- The returned
media_idcan be used asfeatured_mediain the Create/Update Post nodes. - The file URL must be public and accessible from the server.
Related Nodes
Section titled “Related Nodes”- WordpressCreatePost - Create post with the uploaded image as featured
- WordpressCreatePage - Create page with the uploaded image as featured
- WordpressUpdatePost - Update post featured image
- WordpressGetMedia - Query existing files in the library