Skip to main content

Developer tools

Shortcode in Core Forms

Use [cf_form slug="your-form"] anywhere WordPress accepts a shortcode.

Bundled with Core Forms, the WordPress forms plugin with every premium feature in the box. No add-on tax.

Bundled, no add-on tax Unlimited sites

The [cf_form] WordPress form shortcode embeds a Core Forms form anywhere WordPress processes shortcodes: classic posts and pages, text widgets, page builder text modules and theme templates through do_shortcode(). Reference the form by slug or by ID; if you pass both, the ID wins. Scripts and styles load automatically.

Sometimes a shortcode is just simpler. Drop [cf_form slug="contact"] into a classic-editor post, a widget, a page builder block, an email template, or a custom theme template.

Shortcode at a glance

By slug
[cf_form slug="contact"]
By ID
[cf_form id="42"]
Priority
id wins over slug
Works in
Posts, pages, widgets, page builder text modules
In PHP
do_shortcode() or cf_get_form()

Full reference: Embedding forms

What you get

How Shortcode works in Core Forms

By slug or ID

[cf_form slug="contact"] or [cf_form id="42"] — your call.

Universal

Works in classic editor, page builders, widgets, email subject lines, anywhere shortcodes do.

Theme-template embed

Use do_shortcode() in any PHP template — drop a form into a header, footer, or custom block.

Use cases

What people build with Shortcode and Core Forms

Classic editor and text widgets

Paste [cf_form slug="newsletter"] into a classic post or a Text widget under Appearance > Widgets.

Forms in theme templates

Echo do_shortcode() in a template file such as a page or sidebar, or use cf_get_form() and get_html() for more control.

A different form per page

Wrap the shortcode in is_page() checks so careers, support and other pages each get their own form.

Several forms on one page

Stack a contact form and a newsletter form; each validates and shows its own success message.

Set it up

Connect Shortcode in 3 minutes

  1. 1

    Note your form slug

    On the form list, the shortcode chip displays the exact slug to use.

  2. 2

    Paste it in

    [cf_form slug="contact"] inside any content or template.

Every setting, filter, and error message is documented in the Embedding forms.

Shortcode usage

[cf_form slug="contact"]

[cf_form id="42"]
Good to know

Requirements and limits

  • Slugs are easier to read, but the ID is safer when several forms have similar slugs.
  • In a theme file, call do_shortcode() after WordPress has initialized, or the form won't render.
  • Forms loaded through AJAX or other unusual contexts may need the core-forms and core-forms-a11y scripts enqueued by hand.
  • In the block editor, a Shortcode block can be transformed into the native Core Form block for a live preview.
FAQ

Shortcode integration questions

Where do I find my form's slug or ID?
The slug sits below the title in the form editor. The ID is the number after form_id in the URL while you edit the form, for example form_id=42.
Should I use the slug or the ID?
Use the slug for readability. Use the ID when several forms have similar slugs. If you pass both, the ID takes priority.
Can I use the shortcode inside Bricks or Elementor?
It works in any text module that processes shortcodes, but both builders have native options. The Bricks element and Elementor widget add form selection and style controls without pasting a shortcode.
Do I need to enqueue scripts or styles myself?
No. Core Forms loads its JavaScript and CSS whenever a form renders. Only forms loaded through AJAX or other unusual contexts may need wp_enqueue_script( 'core-forms' ) and the a11y script added by hand, as the embedding guide shows.
How do I embed a form in PHP without the shortcode?
Call cf_get_form( 'contact' ) with a slug or ID, check that it returned a form, and echo $form->get_html(). That renders the complete form with its wrapper, nonce and honeypot.
Why isn't my shortcode showing a form?
Check that a form with that slug or ID exists under Core Forms. If you're calling do_shortcode() from a theme file, make sure it runs after WordPress has loaded.

Bundled with every Core Forms license.

Shortcode and every Core Forms-built integration on this site are included with your license.