Introduction

In today's digital landscape, controlling access to valuable content is crucial for many WordPress sites. Whether you're offering premium downloads, exclusive video training, client-specific documents, or internal company resources, implementing a robust content gating mechanism is essential. This ensures that only approved users can access your protected materials, enhancing security and streamlining your workflows.

WordPress Gatekeeper Pro simplifies this process, allowing you to easily lock down content across any post type, from standard posts and pages to custom post types (CPTs) and even WooCommerce products. This article will guide you through the step-by-step setup, focussing on how to enable content gating for your chosen post types and configure the various field sources available.

Understanding Content Gating on Various WordPress Post Types

Content gating involves restricting access to certain parts of your website until a user completes a specific action, such as submitting a request form. While often associated with lead generation, its utility extends far beyond marketing. For WordPress developers and technical implementers, the flexibility to apply gating to any post type opens up a world of possibilities:

  • Custom Post Types (CPTs): Perfect for client portals, resource libraries, or product documentation, where specific CPTs need restricted access.
  • Pages and Posts: Ideal for premium articles, members-only blog content, or confidential company announcements.
  • Media Attachments: Directly protect downloadable files or embedded videos without needing a separate post.
  • WooCommerce Products: Gating specific product information (e.g., technical specifications, user manuals) that requires pre-approval.

The core challenge is integrating the gating mechanism seamlessly with WordPress's inherent data structures and your existing content management practices, especially when dealing with custom fields and different post types.

Step 1: Install and Activate Gatekeeper Pro

Before you can configure content gating, you'll need to install the Gatekeeper Pro plugin. This process is straightforward, much like any other WordPress plugin.

  1. Download the plugin: Obtain the plugin ZIP file from your SauceCode account.
  2. Upload and install: Navigate to your WordPress admin dashboard, go to Plugins > Add New > Upload Plugin. Choose the ZIP file and click Install Now.
  3. Activate: Once installed, click Activate Plugin.
  4. Enter Licence Key: After activation, you'll be prompted to enter your licence key under Gatekeeper Pro > Settings > Licence to unlock all features and receive updates.

Step 2: Enable Content Gating on Your Post Type

The first crucial step in setting up content gating is to specify which WordPress post types should have the gating functionality enabled. Gatekeeper Pro provides a dedicated interface for this.

  1. Access Plugin Settings: From your WordPress dashboard, navigate to Gatekeeper Pro > Settings > Post Types.
  2. Select Post Types: You'll see a list of all public post types registered on your WordPress installation. This includes standard 'Posts' and 'Pages', as well as any custom post types you've created (e.g., 'Products', 'Documents', 'Courses').
  3. Toggle "Enable Gating": For each post type where you want to apply content gating, simply toggle the "Enable Gating" switch to the ON position. This action adds the necessary meta box and functionality to that post type's edit screen.
  4. Save Changes: Remember to click the Save Changes button at the bottom of the page to apply your selections.

Once enabled, when you edit a post of the selected type, you'll notice a new "Gatekeeper Pro" meta box in the editor, providing options to lock content and configure resource protection.

Step 3: Configure Field Sources

One of Gatekeeper Pro's most powerful features is its flexibility in how it sources the "Locked" status and associated file/video fields. You can choose between using the plugin's native meta boxes, mapping to Advanced Custom Fields (ACF), or using custom meta keys. This is particularly valuable for developers who need to integrate with existing custom field setups or build highly bespoke solutions.

You configure the field source for each enabled post type independently. This setting is found directly beneath the "Enable Gating" toggle for each post type on the Gatekeeper Pro > Settings > Post Types page.

Using Native Meta Boxes

The "Native Meta Box" option is the default and often the simplest way to get started. When selected, Gatekeeper Pro adds its own dedicated meta box to the post type's edit screen. This meta box contains all the necessary fields for enabling content gating and attaching protected resources.

  • When to use:
    • You prefer an out-of-the-box solution without needing to create custom fields.
    • You're starting a new project and don't have existing custom field structures for content gating.
    • You want minimal setup and direct control over gating options within the standard WordPress editor.
  • Configuration:
    • On the Gatekeeper Pro > Settings > Post Types page, select "Native Meta Box" from the dropdown for your desired post type.
    • Save your changes.
  • Developer Insight: The native meta box uses standard WordPress meta keys (e.g., _gkp_locked, _gkp_file_id) internally. While you don't interact with these directly through the UI, understanding this helps if you ever need to query post meta programmatically.

ACF Field Mapping

For WordPress developers heavily relying on Advanced Custom Fields (ACF), Gatekeeper Pro offers seamless integration by allowing you to map its core gating fields to your existing ACF fields. This means you can manage content locking and resource attachments directly from your familiar ACF field groups.

  • When to use:
    • You already use ACF extensively for your post types and prefer a unified content management experience.
    • You need to apply conditional logic or other ACF features to your gating fields.
    • You're building complex client portals or resource libraries where ACF is central to your data structure.
  • Configuration Steps:
    1. Create ACF Fields: First, ensure you have the necessary ACF fields set up within an ACF Field Group that applies to your target post type. You'll need at least two fields:
      • A Checkbox or True/False field for the "Locked" status (e.g., is_gated).
      • A File field for downloadable resources (e.g., gated_file).
      • A URL field for video streaming (e.g., gated_video_url).
    2. Select "ACF Field Mapping": On the Gatekeeper Pro > Settings > Post Types page, select "ACF Field Mapping" from the dropdown for your desired post type.
    3. Map ACF Fields: The "Field Detector" will then automatically scan your ACF field groups and display dropdowns for "Locked Field (ACF)", "File Field (ACF)", and "Video URL Field (ACF)".
    4. Choose Your Fields: Select the corresponding ACF fields you created in step 1 from these dropdowns. For example, map your 'is_gated' ACF field to the "Locked Field (ACF)" setting.
    5. Save Changes: Click Save Changes.
  • Developer Insight: Gatekeeper Pro's "Field Detector" intelligently identifies compatible ACF fields, making the mapping process straightforward. This integration ensures that when an admin ticks your custom 'is_gated' ACF checkbox, Gatekeeper Pro correctly interprets that post as locked and applies its protection mechanisms.

Using Custom Meta Keys

For advanced developers who prefer to define their own custom meta keys or integrate with other custom field plugins beyond ACF, the "Custom Meta Keys" option provides maximum flexibility. This allows you to manually specify the exact meta keys Gatekeeper Pro should use to determine the locked status and associated resource files/videos.

  • When to use:
    • You are integrating with a custom framework or another custom field plugin that isn't ACF.
    • You need very specific control over the meta keys used for content gating.
    • You're building a highly customised solution where direct meta key manipulation is preferred.
  • Configuration Steps:
    1. Select "Custom Meta Keys": On the Gatekeeper Pro > Settings > Post Types page, select "Custom Meta Keys" from the dropdown for your desired post type.
    2. Enter Meta Keys: Text fields will appear for "Locked Meta Key", "File Meta Key", and "Video URL Meta Key".
    3. Input Your Keys: Manually enter the meta keys you want Gatekeeper Pro to use. For example, you might use my_custom_locked_status for the locked field, my_gated_document for the file field, and my_protected_video_link for the video URL.
    4. Save Changes: Click Save Changes.
  • Developer Insight: When using custom meta keys, Gatekeeper Pro will look for a truthy value (e.g., '1', 'true', 'yes') for the "Locked Meta Key" to determine if content is gated. For the file and video keys, it expects an attachment ID or a URL, respectively. This gives you granular control over how your content's gated status is stored and retrieved.

    Once you've configured the field source for your chosen post type, the next steps involve actually locking the content and, if applicable, attaching the protected resource.

Step 4: Mark Content as Locked

With content gating enabled on your post type and the field source configured, you can now designate individual posts or custom post type items as "locked."

  1. Edit a Post: Navigate to the edit screen for any post, page, or CPT item of the type you enabled in Step 2.
  2. Locate Gating Field:
    • If using Native Meta Boxes, find the "Gatekeeper Pro" meta box (typically on the right sidebar or below the content editor).
    • If using ACF Field Mapping, find the ACF field group containing your mapped "Locked" field.
    • If using Custom Meta Keys, you'll need to use your custom field interface (e.g., custom fields meta box) to set the value of your chosen meta key.
  3. Activate Locking: Tick the checkbox or set the appropriate value that signifies "Locked" (e.g., '1' for a custom meta key).
  4. Update/Publish: Save your changes by clicking the Update or Publish button.

Once marked as locked, Gatekeeper Pro immediately applies its protection, ensuring that the content cannot be accessed without a valid token. On the frontend, visitors will now see the access request form (if enabled) or a placeholder, rather than the original content.

Step 5: Attach a Protected Resource (Optional but Common)

Often, content gating is used to protect specific files or videos. Gatekeeper Pro makes it easy to associate these resources directly with your locked content.

  1. Edit Your Locked Post: Go back to the edit screen of the post you just locked.
  2. Locate Resource Fields:
    • If using Native Meta Boxes, within the "Gatekeeper Pro" meta box, you'll see fields for "Protected File" and "Protected Video URL".
    • If using ACF Field Mapping, locate your mapped "File" and "Video URL" ACF fields.
    • If using Custom Meta Keys, use your custom field interface to input the attachment ID (for a file) or the video URL (for a video) into your chosen meta keys.
  3. Upload/Select File: For a downloadable file, use the "Upload File" button (or your ACF file field) to select an existing file from your Media Library or upload a new one. Gatekeeper Pro will automatically move this file to its secure, protected directory, rename it with a SHA-256 hash, and block direct access via .htaccess.
  4. Enter Video URL: For a protected video, paste the URL of your video (e.g., from your media library or a secure external host) into the "Protected Video URL" field (or your ACF/custom meta key field). Gatekeeper Pro will stream this video via a secure proxy endpoint that validates tokens before playback.
  5. Update/Publish: Save your changes.

Now, when an approved user receives an access token for this locked content, they will be able to securely download the file or stream the video, with all access managed and tracked by Gatekeeper Pro.

Step 6: Display the Gated Content on the Frontend

Once your content is locked and resources are attached, you'll need to display the appropriate gating interface on your website's frontend. Gatekeeper Pro offers several flexible methods:

  • Shortcodes: For Gutenberg and any page builder that supports shortcodes, Gatekeeper Pro provides dedicated shortcodes like [gkp_content_gate] to display the access form or the content itself based on token status, or [gkp_resource_card] for comprehensive content listings.
  • Elementor Widgets: If you're using Elementor, dedicated widgets such as "Content Gate," "Gated Video," and "Download Button" allow for drag-and-drop integration and visual configuration.
  • PHP Template Tags: For theme developers, direct PHP template tags (e.g., GatekeeperPro::render_gate()) provide maximum control for integrating content gating directly into your theme's templates.

These tools ensure that regardless of your WordPress build method, you can effectively present your gated content and access request forms to visitors.

Managing Access Requests and Tokens

After setting up content gating, the final piece of the puzzle is managing who gets access. Gatekeeper Pro includes a complete workflow:

  • Access Request Form: When a user tries to access locked content, they'll encounter a native AJAX request form (or your integrated Formidable Form) where they can submit their details.
  • Admin Notifications: Admins receive email notifications for new requests, with one-click approval/disapproval links that work directly from the email—no WordPress login required.
  • Secure Tokens: Upon approval, users receive an email with a secure, time-limited access token. This token grants them access to the specific resource (per-item mode) or all locked resources (sitewide mode), depending on your settings.
  • Admin Dashboard: The Gatekeeper Pro > Access Requests and Gatekeeper Pro > Tokens dashboards provide full oversight, allowing you to manage pending requests, view active tokens, and track access analytics.

This comprehensive system ensures that content access is not only restricted but also managed efficiently and securely, providing an audit trail for all interactions.

Conclusion

Setting up content gating on any WordPress post type, including custom post types, is a powerful way to protect valuable resources, generate leads, or streamline internal document distribution. With Gatekeeper Pro, the process is flexible and robust, allowing you to choose between native meta boxes, ACF field mapping, or custom meta keys to best suit your project's needs.

By following these steps, you can confidently implement a secure, token-based content restriction system across your entire WordPress site, ensuring your protected files, videos, and pages are only accessible to those with approved permission. This empowers you to build more sophisticated and secure WordPress applications for your clients or your own business.