Newsletter2Go Shortcode

Below, you’ll find a detailed guide on how to add the Newsletter2Go Shortcode to your WordPress website, including its parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Newsletter2Go Plugin shortcode not to show or not to work correctly.

Before starting, here is an overview of the Newsletter2Go Plugin and the shortcodes it provides:

✩✩✩✩✩ () Active Installs: + Tested with: PHP Version:
Included Shortcodes:

Newsletter2Go [newsletter2go] Shortcode

The Newsletter2Go shortcode allows you to customize subscription forms. It uses the ‘newsletter2go’ shortcode and the ‘n2Go_Shortcode’ function. This function lets you set the title, form type (subscribe or unsubscribe), and form style (popup or default). You can also set a delay for the popup form. The shortcode then returns a new instance of the N2Go_Widget with these parameters.

Shortcode: [newsletter2go]


Here is a list of all possible newsletter2go shortcode parameters and attributes:

  • title – specifies the title of the form
  • form_type – determines if the form is for subscribing or unsubscribing
  • type – sets the form as a popup or a regular form
  • delay – sets the delay time for the popup form in seconds

Examples and Usage

Basic example – The Newsletter2Go shortcode can be used to create a simple subscription form on your WordPress site. This shortcode does not require any additional parameters or attributes.


Advanced examples

Creating a subscription form with a custom title. This shortcode will create a subscription form with the title “Subscribe to our Newsletter”.

[newsletter2go title="Subscribe to our Newsletter"]

Creating an unsubscribe form. This shortcode will create an unsubscribe form, allowing users to remove themselves from your mailing list.

[newsletter2go form_type="unsubscribe"]

Creating a popup subscription form. This shortcode will create a popup subscription form that appears after a delay of 5 seconds.

[newsletter2go type="popup" delay=5]

Creating a popup unsubscribe form with a custom delay. This shortcode will create a popup unsubscribe form that appears after a delay of 10 seconds.

[newsletter2go form_type="unsubscribe" type="popup" delay=10]

PHP Function Code

In case you have difficulties debugging what causing issues with [newsletter2go] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode('newsletter2go', 'n2Go_Shortcode');

Shortcode PHP function:

                    function n2Go_Shortcode ($attr)
    $instance['title'] = isset($attr['title']) ? $attr['title'] : '';
    $args = array();

    $form_type = 'subscribe';
    if (is_array($attr) && isset($attr['form_type'])) {
        switch ($attr['form_type']) {
            case 'unsubscribe':
                $form_type = 'unsubscribe';
                $form_type = 'subscribe';

    if (is_array($attr) && isset($attr['type'])) {
        switch ($attr['type']) {
            case 'popup':
                $args['params'][0] = "'" . $form_type . ":createPopup'";
                (isset($attr['delay'])) ? $args['params'][3] = $attr['delay'] : $args['params'][3] = 5;
                $args['params'][0] = "'" . $form_type . ":createForm'";

    $instance['type'] = $form_type;

    $widget = new N2Go_Widget;
    return $widget->widget($args, $instance, false);

Code file location:



Now that you’ve learned how to embed the Newsletter2Go Plugin shortcode, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.


Leave a Reply

Your email address will not be published. Required fields are marked *