Newsletter Subscription Shortcode

You can use the following shortcode to display a newsletter subscription form in your post, page, or text widget.


By default, Noptin applies basic CSS styles to your form fields. If the applied styles conflict with your theme styles, use the shortcode below instead.

[noptin styles=none]

Display Existing Forms

You can pass the id of an existing form to the shortcode, and Noptin will display that form instead of the default form.

For example,

[noptin form=8875]

The above shortcode will display the form with ID 8875. On my site, the following form will be displayed.

noptin subscription form

If you provide a form ID that does NOT exist, the shortcode will display nothing.

If you’re displaying an existing form and you pass in one of the below attributes to the shortcode, the passed attribute will override the relevant setting that you set in the form builder.

Confirmation Messages

When someone submits your newsletter sign-up form, Noptin will display the appropriate confirmation message depending on the result of the submission.

The example confirmation message below is shown when someone successfully submits the form.

successfully subscribed to newsletter

These confirmation messages can be changed using the following shortcode attributes.

AttributeDefault Value
invalid_emailPlease provide a valid email address.
errorOops. Something went wrong. Please try again later.
required_field_missingPlease fill in all the required fields.
accept_termsPlease accept the terms and conditions first.
already_subscribedYou are already subscribed to the newsletter, thank you!
updatedThank you, your details have been updated.
successThanks for subscribing to the newsletter.

For example,

[noptin success="Custom subscribe message"]

Redirect Subscribers

Noptin allows you to redirect subscribers to any URL after they submit your form successfully. This is useful, for example, if you want them to show them a custom thank you page.

To do this, pass a URL to the “redirect” attribute as shown below.

[noptin redirect=""]

Form Fields

The “fields” attribute allows you to set which custom fields should show up on the form, and in which order they will show up.

For example,

The below shortcode…

[noptin fields="first_name,birthday,email"]

… will display a form similar to the one you see below.

sample newsletter subscription form with birthday


Do not use field labels search as First Name, Email Address, etc. Instead, pass in the field keys.

Single-line Horizontal Forms

By default, Noptin displays each form field on a single line.

If your form only contains an email address field, you can change it to display the email address field and subscribe button on a single line.

To do this, set the “template” attribute to “condensed” as shown below.

[noptin template="condensed"]

This will display a form such as the one below.

horizontal newsletter sign-up form

Other Attributes

Below are other shortcode attributes that you can set.

labelsHide or show field labels[noptin labels=hide]
wrapSet which HTML element should be used to wrap form fields[noptin wrap=p]
html_idSet the HTML ID of the Form[noptin html_id=custom_form_id]
html_nameSet the HTML name of the Form[noptin html_name=custom_form_name]
html_classSet the HTML class of the form[noptin html_class="first_class second class"]
acceptanceDisplay “terms of service” acceptance checkbox[noptin acceptance="I agree to your terms"]
submitChange the text of the submit button[noptin submit="Join Newsletter"]

Further Reading

Up your Marketing
Join our email list to and we'll send you occasional marketing tips
Custom CSS Slide Example
Custom Animation Example
Default Animation