Add Custom CSS 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 →

Add Custom CSS

Write

Adds custom CSS to a specific element or to the entire page (requires Elementor Pro).

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

Strips PHP tags, <script> tags, and common CSS-based XSS vectors (expression(), behavior:, @import, url(javascript:...), url(data:text/html...)) from the input CSS. If element_id is given, loads the page data, finds the element, and appends (or replaces, if replace=true) the sanitized CSS into its custom_css setting via update_element_settings, then saves the page. If element_id is omitted, the same append/replace logic is applied to the page-level custom_css setting via get_page_settings/save_page_settings.

See it in action

You ask your AI assistant

"Add page-level CSS on post 42 that changes the body background to a light gray."

Inputs

Name Type Required Description
post_id integer Yes The post/page ID.
element_id string No Optional element ID to apply CSS to. If omitted, CSS is applied at the page level.
css string Yes CSS rules to add. Use "selector" as the element wrapper placeholder for element-level CSS.
replace boolean No If true, replaces existing custom CSS instead of appending. Default: false.

Returns

Returns success boolean, target (element:<id> or page:<post_id>), and the resulting css string.

Permission

check_raw_code_permission requires the unfiltered_html capability plus edit_posts (and edit_post on post_id if provided), since raw CSS/JS markup is persisted into post content.

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.