skip to Main Content

Magic Buttons & Magic Links

The Magic Button integration enables users to simply click a button to complete a trigger in a recipe. It’s like a custom WordPress button that can do almost anything you want it to—no custom code or programming required!

There are a couple of ways to use this button:

  • Create a recipe with a single trigger (the Magic Button).  Clicking the button immediately runs the recipe’s actions on the user.  This enables you to give users a button that can do anything Automator has an action for, or even execute multiple actions (enrolling the user in a course, sending them an email, adding a new role, etc.).
  • Create a recipe with multiple triggers (including one or more Magic Buttons).  Clicking the button indicates the user has completed one of the recipe’s requirements, and the recipe’s actions run when the user has completed all triggers.  This enables you to create triggers for behaviors that Automator doesn’t support natively, by allowing users to self-complete a trigger in a multi-trigger recipe.

Using the Magic Button

Generating a Magic Button is simple. From your WordPress Admin Dashboard, navigate to Automator > Add new recipe. Select your recipe type, either Logged-in users or Everyone. You will then find the Magic Button integration in the Trigger panel of the recipe editor.

magic-button-integration

The Magic Button integration has two options:

magic-button-triggers

Both triggers for the Magic Button integration behave the same way; the difference is in their appearance. The “magic button” provides the shortcode for a clickable button, while the “magic link” provides the shortcode for hyperlinked text.

magic-button-triggers-live

Shortcode attributes

The shortcode for a magic button or magic link can be placed anywhere on your WordPress website. Copy it directly from the trigger and place it on any page or post.

The following attributes are available for magic button and magic link shortcodes:

  • labelUse different label text for the magic button in its default state
  • text: Use different hyperlinked text for a magic link
  • is_ajax: When set to “yes”, the magic button processes the recipe via an Ajax call instead of a page reload
  • submit_message: Use different button label text after the button was clicked on Ajax submission but before the recipe has finished running
  • success_message: Use different button label text after the button has been clicked and the recipe completed for an Ajax submission.

Here’s an example of a magic button with Ajax submission and a different message on submit:

Gutenberg blocks

Instead of using shortcodes, Gutenberg blocks are available for including magic buttons and links on a page or post. Here’s what a magic button block looks like:

Magic Button Block

To add the correct button to a page, you must create the recipe with the magic button or link first and make it live. You will then see it in the drop-down list, so you can easily locate buttons and links by recipe and trigger.

Best Practices

Clicking the button will reload the page the user is on.  That could be a confusing user experience, as there won’t be any visual confirmation that the button was clicked or the actions have been completed.  So in the recipe containing the button, we recommend checking Redirect when all triggers are completed to take the user to a page that describes what actions have been completed and suggests next steps.

redirect-when-all-triggers-are-completed

Knowledge Base Articles

Back To Top