30 days free. No credit card. Full access from the moment you connect your site.

Start free trial

Add Elementor Image

elementor/add-image inserts an Elementor image widget from an attachment ID or a URL.

Which of those two you use has consequences beyond convenience.

At a glance

Abilityelementor/add-image
ToolsetElementor — toolset/elementor
GroupElementor › Elements & Widgets
RequiresElementor, active on the site
Capabilitymanage_options
SafetyWrites data
RepeatableNot idempotent — each call changes the row set, so re-running is not a no-op
Ships inAcrossAI Abilities Manager 0.0.34 and later

Attachment ID or URL

An attachment ID ties the widget to a media library item. Elementor can then serve the right registered size for the context, generate srcset for responsive delivery, and pick up the alt text stored on the attachment.

A URL gets none of that. The image is a fixed reference to a fixed file: one size for every device, no responsive set, and no alt text unless it is set on the widget.

So an attachment ID is the right choice for anything on this site, and a URL is for images genuinely hosted elsewhere.

The size parameter selects among WordPress’s registered sizes, which only means anything with an attachment ID.

Alt text is not a parameter here because it belongs on the attachment, where every use of the image benefits from it. An image used in three places should not need its alt text written three times.

Not idempotent.

Input

NameTypeRequiredWhat it is
post_idintegerYesThe post holding the Elementor document.
attachment_idintegerOne of these twoA media library attachment ID.
urlstringOne of these twoA direct image URL.
sizestringNoA registered image size. Only applies with an attachment ID.
alignstringNoAlignment.
captionstringNoA caption shown beneath the image.
linkobjectNoA link wrapping the image.
parent_idstring | nullNoThe element to insert into. Null or omitted inserts at the document root.
positionintegerNoIndex among the parent’s children. Omitted appends at the end.

What comes back

NameTypeWhat it is
post_idintegerThe post written.
element_idstringThe ID of the element created or affected.
elementobjectThe element as stored.
successbooleanWhether the call completed.
messagestringA one-line summary of what happened, suitable for showing a human.
error_codestringPresent only on failure — a stable machine-readable reason, such as a missing field, a wrong field type or an unmet confirmation.

Example

Ask your assistant:

Add the hero image to that container.

It resolves to one call:

{
  "ability": "elementor/add-image",
  "parameters": {
    "post_id": 412,
    "attachment_id": 2201,
    "size": "large",
    "parent_id": "a1b2c3d"
  }
}

Worth knowing

  • An attachment ID gets responsive sizes and the stored alt text. A URL gets neither.
  • Alt text belongs on the attachment, not on each widget.
  • The size parameter needs an attachment ID to mean anything.
  • Not idempotent.

Related abilities


Get the plugins:
AcrossAI Abilities Manager · AcrossAI MCP Manager

Browse the rest: Every ability, by category


Keep reading