Blog

Two Methods to Form-Gate Content in WordPress

August 4th, 2021
one person handing another person a black paper heart

You might be asking yourself why the trouble? The answer is quite simply, because you want emails to market to. That being said, there are two basic methods to gate downloads on your WordPress website. While these methods are not secured behind a password, they rely on being obscured from public view until a condition is met, which in this case is completing a form, upon which the user is directed to the link in some fashion.

Requirements

The steps below will assume that WordPress has two plugins installed:


The Thank You Page Method

Please Note: This method is less reliable if the goal is gathering verifiable emails, since a user could theoretically submit a nonsense email and still access the download.

The “Thank You” page method involves placing a form on a page, requiring a user to complete the form, and the form redirecting the user to a Thank You page where there exists a link or button to the gated content, such as a PDF or other document.

  1. Log in as an administrator to WordPress.
  2. Click on “Media” in the main menu and upload your PDF or other gated file to your media library.
  3. Click on file you uploaded in the last step to bring up the Attachment Details pane for the file.
  4. Click the “Copy URL to Clipboard” button on the right side of the panel. Close the panel.
  5. Click on “Pages” in the main menu, and create a new page. This should be your Form page where the user will complete and submit their information before gaining access to the download. For now, don’t worry about the placing the form on the page (we will add it later).
  6. Create an additional page parented by the page from the last step. This should be your Thank You messaging page where the user will download their material from. Add a link to your content, using the URL you copied from step 4.
  7. Scroll to the bottom of the editor window and find the “Yoast SEO” controls. Expand the “Advanced” controls, and set the “Allow search engines to show this Page in search results?” dropdown to “No”. Save and publish the page. Copy the URL of this page by right-clicking the “Permalink” value at the top of the page.
  8. Click on “Contact” in the main menu.
  9. Create a new form and add the following code snippet to the form at the bottom:
    <!-- Redirect to a Thank You Page -->
    <script>
      document.addEventListener( 'wpcf7mailsent', function( event ) {
        location = 'PUT THE PERMALINK FROM STEP 7 HERE';
      }, false );
    </script>

    Note: Make sure you replace the “PUT THE PERMALINK FROM STEP 7 HERE”.
    Save the changes you’ve made.
  10. Click on “Contact” in the main menu.
  11. Copy the corresponding “Shortcode” beside the from you just created.
  12. Click on “Pages” in the main menu, and edit the page you created in step 5. Paste the shortcode into your content area. Save your changes.

Congratulations!

You’ve successfully gated a download using a form and a thank-you page!


The Receipt Email Method

Please Note: This method is more preferable compared to the “Thank You Page” method since it requires a real email to be used in order for the download to be exposed.

The “Emailed Link” method involves placing a form on a page, requiring a user to complete the form, and the form sending a receipt email to the user which will contain the link to the gated content, such as a PDF or other document.

  1. Log in as an administrator to WordPress.
  2. Click on “Media” in the main menu and upload your PDF or other gated file to your media library.
  3. Click on file you uploaded in the last step to bring up the Attachment Details pane for the file.
  4. Click the “Copy URL to Clipboard” button on the right side of the panel. Close the panel.
  5. Click on “Pages” in the main menu, and create a new page. This should be your Form page where the user will complete and submit their information before gaining access to the download. For now, don’t worry about the placing the form on the page (we will add it later).
  6. Click on “Contact” in the main menu.
  7. Create a new form, and click on the “Mail” tab. Scroll down to the Mail (2) option and check the box. Paste the URL from step 4 into the Message body of the email along with whatever content you’d like to send to the user who signed up. Save the changes you’ve made.
  8. Click on “Contact” in the main menu.
  9. Copy the corresponding “Shortcode” beside the from you just created.
  10. Click on “Pages” in the main menu, and edit the page you created in step 5. Paste the shortcode into your content area. Save your changes.

Congratulations!

You’ve successfully gated a download using a form and a receipt email!