Upload Image to Media Library is a WordPress ability from Premium Addons for Elementor — usable via Easy MCP AI, which connects Claude, ChatGPT, and any AI assistant to your site.

Install Free Plugin →

Upload Image to Media Library

Write

Download an image from a public URL into the WordPress media library, after the user has explicitly approved the upload.

Requires the Premium Addons for Elementor plugin on WordPress 7.0+ for the Abilities API (abilities are registered only when the wp_register_ability() function exists). Dashboard, settings and site-inventory abilities (get-id-by-title, list-pages, list-templates, get-global-settings, get-settings, update-setting, scan-usage, disable-unused-widgets, clear-dynamic-assets, subscribe-newsletter) require the caller hold the 'manage_options' capability. premium-addons/create-page requires 'edit_pages'. premium-addons/get-widget-schema, premium-addons/get-addon-schema, premium-addons/list-available-elements, premium-addons/list-pa-addons, premium-addons/detect-atomic-support, premium-addons/check-elementor-element and premium-addons/create-elementor-template require 'edit_posts'. premium-addons/get-page-structure, premium-addons/get-element-settings, premium-addons/add-flexbox, premium-addons/add-container, premium-addons/update-element-settings, premium-addons/insert-widget, premium-addons/remove-element, premium-addons/change-post-status and premium-addons/duplicate-post require 'edit_post' on the target post_id, and deny requests for a nonexistent post_id outright.

What it does

This ability downloads an image from a public http(s) URL and adds it to the WordPress media library, ready to reference from a build ability. It requires a consent flag set to exactly true — the plugin's own guidance is to only run it after asking the user for approval, and it returns a clear error if consent is missing or not strictly true. It rejects private, loopback and internal addresses via wp_http_validate_url(), enforces a 30-second download timeout and a 5MB file-size cap, and validates the downloaded bytes are actually an accepted image type (SVG is not supported) rather than trusting the URL's extension. If the same source_url was already sideloaded before, it returns the existing attachment instead of downloading a duplicate (reused: true in the response), while still applying any new alt text or title passed in the call. You can optionally set filename, alt text, and title; title falls back to the filename and filename is derived from the URL when omitted.

See it in action

You ask your AI assistant

"Add this image to my media library: https://example.com/hero.jpg, with alt text 'Team collaborating around a table'."

Inputs

Name Type Required Description
source_url string Yes The public http(s) URL of the image to download. Private, loopback and internal addresses are rejected.
filename string No The filename to store the image under, with its extension. Derived from the source URL when omitted.
alt string No The alt text to store on the new attachment. Describe what the image shows.
title string No The attachment title. Taken from the filename when omitted.
consent boolean Yes Must be true. Confirms the user explicitly approved adding this file to their media library. Never set it without asking them first.

Returns

An object with id (the attachment ID), url (the full size image URL on this site), width, height, mime_type, alt (the stored alt text), and reused (true when an existing attachment for this source URL was returned instead of downloading a new copy).

Permission

The current user must have the 'upload_files' capability, checked via Admin_Helper::check_user_can('upload_files').

Newsletter

The AI + WordPress space moves fast. Keep up.

New tools, workflow ideas, and product updates — be the first to know what's next.

No spam, unsubscribe anytime.