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

[noptin]

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="http://example.com/thank-you"]

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

Important!

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.

AttributeDescriptionExample
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

Related Guides

  • Creating Subscription Forms

    Learn how to create newsletter subscription forms using our form builder

    Read More

  • Newsletter Subscription Widget

    Our newsletter subscription widget allows you to add a newsletter sign-up form to your header, footer, sidebar, Elementor, or any other place that supports widgets.

    Read More

  • Newsletter Subscription Block

    If you’re using the new WordPress editor, you can use our Newsletter Block to add a subscription form to your posts and widgets.

    Read More

  • Pop-up Forms

    This guide shows you how to create a newsletter subscription pop-up form in WordPress. Unlike normal newsletter sign-up forms, pop-up forms have significantly higher conversion rates. In fact, the average conversion rate is 3.09%. Below is an example of an “exit-intent coupon code pop-up“. Noptin allows you to create such a system without writing any…

    Read More

  • Sliding Forms

    Learn how to create sliding newsletter sign-up forms. Forms can slide in from the bottom left, top left, bottom right, or top right.

    Read More

  • Creating Custom Newsletter Subscription Forms

    Learn how to add a newsletter subscription checkbox to any custom form

    Read More

  • Preventing Spam Sign-Ups

    Noptin uses several methods to prevent spam signups while keeping the forms easy to use for non-spammers. If, however, you are still getting spam sign-ups, you can install any of the following plugins to fight spammers. La Sentinelle antispam This plugin uses the following techniques to block spam:- Honeypot – this adds a hidden input…

    Read More

  • Redirect Users after Subscription

    Learn how to redirect users to a different page, website or downloadable file after they subscribe to you newsletter.

    Read More

  • Smart Tags

    You can use smart tags in your form messages, welcome emails, or subscription shortcodes to add dynamic content to the form. Noptin will detect the smart tag and replace it with the appropriate value. If the value is not known, Noptin will replace the smart tag with an empty string. Example 1: Display the subscriber’s…

    Read More

  • Unsubscribe Forms

    Noptin allows you to create a newsletter unsubscribe form so that existing subscribers can unsubscribe from your newsletter.

    Read More

  • Change subscription confirmation messages

    Check out the default newsletter subscription confirmation messages and how to edit them

    Read More