Accordion 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 →Accordion
WriteAdds The Plus Addons "Accordion" widget (tp-accordion) to an Elementor container.
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
This ability verifies Elementor is active and that the tp-accordion widget is registered, loads the target page's Elementor data, then builds a widget element of type tp-accordion whose settings are assembled from a large set of optional named parameters (content source, tab title/content, icon style and colors, title and content borders/padding, hover/animation effects, and more) plus any raw key/value pairs passed in a generic settings object. The new widget is inserted into the specified parent container at the given position and the page data is saved. It returns a WP_Error if Elementor or the widget is missing, if post_id/parent_id are missing, or if the target post or parent container cannot be found.
See it in action
You ask your AI assistant
"Add a Plus Accordion widget to container abc123 on page 42 with an FAQ tab title and expand/collapse buttons enabled."
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| post_id | integer | Yes | Elementor page/post ID |
| parent_id | string | Yes | Target Elementor container ID |
| position | integer | No | Insert position. Use -1 to append. Defaults to -1. |
| accordion_type | string | No | Content Source (enum: acf_repeater, content) |
| acf_rep_pro | string | No | acf_rep_pro |
| tab_title | string | No | Title |
| content_source | string | No | Type (enum: content, page_template) |
| tab_content | string | No | Content |
| content_template | string | No | Templates (enum: content_source, show_label) |
| backend_preview_template | string | No | Backend Visibility (enum: yes, no) |
| display_icon | string | No | display_icon (enum: yes, no) |
| display_icon_options | string | No | display_icon_options |
| tabs | array | No | Accordions (array of accordion tab objects) |
| icon_align | string | No | Alignment (enum: display_icon, icon, left, right, toggle) |
| icon_style | string | No | Icon Font (enum: display_icon, font_awesome, font_awesome_5, icon_mind) |
| icon_fs_popover_toggle | string | No | Font Awesome |
| icon_fontawesome | string | No | Icon Library |
| icon_fontawesome_active | string | No | Active Icon Library |
| icon_f5_popover_toggle | string | No | Font Awesome 5 |
| icon_fontawesome_5 | string | No | Icon Library |
| icon_fontawesome_5_active | string | No | Icon Library |
| icons_mind_options | string | No | icons_mind_options |
| title_html_tag | string | No | Title Tag (enum: div, h1, h2, h3, h4, h5, h6) |
| on_hover_accordion | string | No | On Hover Accordion (enum: yes, no) |
| on_hover_section | string | No | on_hover_section |
| horizontal_accordion | string | No | Horizontal Accordion (enum: yes, no) |
| horizontal_section | string | No | horizontal_section |
| tabs_autoplay | string | No | Autoplay (enum: yes, no) |
| autoplay_section | string | No | autoplay_section |
| expand_collapse | string | No | Expand & Collapse Button (enum: yes, no) |
| expand_collapse_section | string | No | expand_collapse_section |
| search_bar | string | No | Search Bar (enum: yes, no) |
| search_bar_section | string | No | search_bar_section |
| slider_accordion | string | No | Slider & Pagination (enum: yes, no) |
| slider_accordion_section | string | No | slider_accordion_section |
| active_accordion | string | No | active_accordion |
| accordion_scroll_top | string | No | accordion_scroll_top (enum: yes, no) |
| scroll_top_section | string | No | scroll_top_section |
| schema_accordion | string | No | schema_accordion (enum: yes, no) |
| schema_accordion_section | string | No | schema_accordion_section |
| accordion_stager | string | No | accordion_stager (enum: yes, no) |
| accordion_stager_section | string | No | accordion_stager_section |
| icon_space | object | No | Gap (slider/size object) |
| toggle_icon_size | object | No | Icon Size (slider/size object) |
| icon_color | string | No | Color (color hex/rgba) |
| icon_fill_color | string | No | Fill (color hex/rgba) |
| icon_stroke_color | string | No | Stroke (color hex/rgba) |
| icon_active_color | string | No | Color (color hex/rgba) |
| icon_fill_color_active | string | No | Active Fill (color hex/rgba) |
| icon_stroke_color_active | string | No | Active Stroke (color hex/rgba) |
| title_accordion_padding | object | No | Padding (dimensions object) |
| title_color_option | string | No | Color (enum: gradient, icon, solid) |
| title_color | string | No | Color (color hex/rgba) |
| title_gradient_color1 | string | No | Color 1 (color hex/rgba) |
| title_gradient_color1_control | object | No | Color 1 Location (slider/size object) |
| title_gradient_color2 | string | No | Color 2 (color hex/rgba) |
| title_gradient_color2_control | object | No | Color 2 Location (slider/size object) |
| title_gradient_style | string | No | Gradient Style (enum: of_type, title_color_option) |
| title_gradient_angle | object | No | Gradient Angle (slider/size object) |
| title_gradient_position | string | No | Position of the header gradient |
| title_active_color_option | string | No | Title Active Color (enum: gradient, icon, solid) |
| title_active_color | string | No | Active Color (color hex/rgba) |
| title_active_gradient_color1 | string | No | Color 1 (color hex/rgba) |
| title_active_gradient_color1_control | object | No | Color 1 Location (slider/size object) |
| title_active_gradient_color2 | string | No | Color 2 (color hex/rgba) |
| title_active_gradient_color2_control | object | No | Color 2 Location (slider/size object) |
| title_active_gradient_style | string | No | Gradient Style (enum: of_type, title_active_color_option) |
| title_active_gradient_angle | object | No | Gradient Angle (slider/size object) |
| title_active_gradient_position | string | No | Position of the active header gradient |
| title_box_border | string | No | Box Border (enum: yes, no) |
| title_border_style | string | No | Border Style |
| title_box_border_width | object | No | Border Width (dimensions object) |
| title_box_border_color | string | No | Border Color (color hex/rgba) |
| title_border_radius | object | No | Border Radius (dimensions object) |
| accordion_space | object | No | Accordion Between Space (slider/size object) |
| content_accordion_padding | object | No | Padding (dimensions object) |
| content_accordion_margin | object | No | Margin (dimensions object) |
| desc_color | string | No | Text Color (color hex/rgba) |
| content_box_border | string | No | Box Border (enum: yes, no) |
| content_border_style | string | No | Border Style |
| content_box_border_width | object | No | Border Width (dimensions object) |
| content_box_border_color | string | No | Border Color (color hex/rgba) |
| content_border_radius | object | No | Border Radius (dimensions object) |
| section_hover_styling_options | string | No | section_hover_styling_options |
| animation_effects | string | No | In Animation Effect |
| animation_delay | object | No | Animation Delay (slider/size object) |
| animation_duration_default | string | No | Animation Duration (enum: yes, no) |
| animate_duration | object | No | Duration Speed (slider/size object) |
| animation_out_effects | string | No | Out Animation Effect |
| animation_out_delay | object | No | Out Animation Delay (slider/size object) |
| animation_out_duration_default | string | No | Out Animation Duration (enum: yes, no) |
| animation_out_duration | object | No | Duration Speed (slider/size object) |
| settings | object | No | Raw Elementor control key/value pairs to merge. Supports kinetic open/close physics, template-based item injection, and responsive interactive geometry. |
Returns
An object with element_id (string), widget_type (string, 'tp-accordion'), and post_id (integer).
Permission
Requires the current user to have the 'edit_posts' capability, and if a post_id is supplied, also 'edit_post' capability for that specific post.
More The Plus Addons for Elementor abilities
Add Code Snippet
Creates a site-wide Custom Code snippet using Elementor Pro, injecting CSS/JS/meta into the head or body on all pages.
Add Container
Adds a new Elementor flex container to a page or nests it inside another existing container.
Add Container
Adds a flex or grid container to a page, optionally nested inside a parent container.
Add Custom CSS
Adds custom CSS to a specific element or to the entire page (requires Elementor Pro).
Add Custom JavaScript
Adds a custom JavaScript snippet to a page by inserting an HTML widget containing a <script> tag; works with free Elementor.
Add Stock Image
Searches Openverse for an image, downloads it to the Media Library, and adds it as an image widget to the page in one step.