Upload SVG Icon is a WordPress ability from The Plus Addons for Elementor — usable via Easy MCP AI, which connects Claude, ChatGPT, and any AI assistant to your site.

Install Free Plugin →

Upload SVG Icon

Write

Uploads an SVG icon to the WordPress Media Library and returns an Elementor icon object ready to use with any widget that accepts icons.

Requires the The Plus Addons for Elementor plugin (which registers under the 'tpae' ability category) on WordPress 6.9+, with Elementor active. Every ability requires the current user to have the 'edit_posts' capability (and 'edit_post' for the specific post being modified); abilities that create or edit content also verify Elementor and, where relevant, the target The Plus widget are available. A subset of abilities (theme templates, template conditions, dynamic tags, popups, and some custom-code abilities) only register when Elementor Pro is active, and many widget abilities load only in the free plugin when the Pro add-on is inactive.

What it does

Accepts either an external svg_url or raw svg_content (not both). Temporarily allows SVG mime uploads and fixes WordPress's filetype detection for SVGs via the upload_mimes and wp_check_filetype_and_ext filters. For a URL it downloads and validates the file actually contains SVG content and no <script> tags (running Elementor's SVG sanitizer if available); for raw content it validates an <svg> tag is present and strips PHP tags, script tags, event handlers, and javascript: URLs before writing to a temp file. Sideloads the resulting file into the Media Library via media_handle_sideload, sets the title, removes the temporary filters, and returns an Elementor-format icon object ({value:{id,url}, library:"svg"}).

See it in action

You ask your AI assistant

"Upload this SVG arrow icon markup and give me the Elementor icon object for a button widget."

Inputs

Name Type Required Description
svg_url string No External URL to an SVG file to download and import. Use this OR svg_content, not both.
svg_content string No Raw SVG markup string (e.g. "<svg viewBox='0 0 24 24'><path d='M12 ...'/></svg>"). Use this OR svg_url, not both.
title string No Title for the SVG in the Media Library. Falls back to filename or "Custom SVG Icon".

Returns

Returns attachment_id, url, and a ready-to-use icon_object (value.id, value.url, library) for the selected_icon setting.

Permission

check_upload_permission requires both manage_options and upload_files capabilities, since SVG is treated as a privileged upload (potential XSS vector even after sanitization).

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.