Embed Form is a WordPress ability from Ninja Forms — usable via Easy MCP AI, which connects Claude, ChatGPT, and any AI assistant to your site.

Install Free Plugin →

Embed Form

Write
Ninja Forms Forms ninjaforms/embed-form

Embed a form in a post or page via shortcode, block, or Gutenberg metabox — creating the page if needed.

Requires the Ninja Forms plugin on WordPress 6.9+ for the Abilities API (all 32 abilities are registered only when the wp_register_ability() function exists, via NF_Abilities_Integration::load_abilities_api() running on plugins_loaded). Every ability is gated by the same ninja_forms_ability_can_manage_forms() permission callback, requiring the caller to hold WordPress's manage_options capability or Ninja Forms' own nf_edit_forms capability.

What it does

This is a two-step ability: called first with just a form_id (and optionally a post_title or post_id), it searches for a matching page and returns its content blocks for the assistant to present, or reports that no matching page was found so the user can confirm creating one. Called a second time with an embed_method (shortcode, block, or metabox) and, for shortcode/block, a placement (before/after/replace/at_beginning/at_end relative to a referenced content block), it performs the actual embed — adding the Ninja Forms shortcode or block into the post content, or relying on the metabox method which auto-appends the form without needing a placement. This lets an AI assistant walk a user through publishing a form onto a page conversationally instead of the user copy-pasting a shortcode themselves.

See it in action

You ask your AI assistant

"Embed form 12 on my 'Contact Us' page, right after the introduction paragraph, using a shortcode."

Inputs

Name Type Required Description
form_id integer Yes ID of the form to embed.
post_id integer No Existing post/page to update.
post_title string No Title for a new page; only used when creating one.
post_content string No Additional content to include alongside the embedded form.
post_status string No Post status: publish, draft, pending, or private. Defaults to 'publish'.
post_type string No Post type: post or page. Defaults to 'page'.
embed_method string No How to embed the form: shortcode, block, or metabox.
placement string No Where to place shortcode/block: before, after, replace, at_beginning, or at_end. Required for shortcode/block methods.
placement_reference string No Which content block to reference for before/after/replace placement.
confirm_create boolean No Must be true to create a new page when no matching page is found. Defaults to false.

Returns

An object with a 'success' boolean, a 'message', the target 'post_id'/'post_title'/'permalink', flags for 'page_found'/'page_not_found'/'needs_embed_method'/'needs_confirmation', the page's 'post_content' and parsed 'content_blocks', and an 'available_methods' array.

Permission

The current user must have WordPress's 'manage_options' capability or Ninja Forms' own 'nf_edit_forms' capability (checked via the shared ninja_forms_ability_can_manage_forms() permission callback).

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.