Introduction
Content gating is a powerful strategy for lead generation, managing access to specific resources, and securing proprietary information on your WordPress site. While native meta boxes offer a basic approach to content restriction, many developers and implementers require more flexibility and control, especially when working with custom post types or complex content structures.
Advanced Custom Fields (ACF) provides that granular control, allowing you to define precisely how and where your content gating settings appear. When combined with a robust plugin like Gatekeeper Pro, ACF transforms into an intuitive and powerful tool for managing access to your valuable resources. This article will guide you through setting up content gating on WordPress using ACF fields, enabling you to lock content on various post types with ease.
Why Choose ACF for Content Gating?
For WordPress developers and technical implementers, ACF offers significant advantages over native meta boxes for managing content gating settings:
- Enhanced Customisation: Create bespoke fields tailored to your specific content gating needs, such as checkboxes for "Locked" status, file uploaders for protected documents, or URL fields for gated videos.
- Seamless Integration with Custom Post Types: ACF shines when working with custom post types, allowing you to display content gating options consistently and intuitively alongside other custom data.
- Improved User Experience: Consolidate content gating settings within logical ACF field groups, making the editing experience cleaner and more efficient for content managers.
- Developer-Friendly Workflows: Leverage ACF's robust API for programmatic access to gating settings, facilitating complex customisations and integrations within themes or plugins.
- Consistency Across Content: Ensure a uniform approach to content restriction across different post types, maintaining a cohesive site structure and administrative interface.
Gatekeeper Pro is designed to work seamlessly with ACF, allowing you to map your custom ACF fields directly to its content gating functions. This flexibility is crucial for building scalable and maintainable content restriction systems.
Prerequisites
Before we begin, ensure you have the following installed and activated on your WordPress site:
- WordPress: A functional WordPress installation.
- Advanced Custom Fields (ACF) Pro: Essential for creating the custom fields we'll be mapping.
- Gatekeeper Pro: The plugin that handles the actual content gating, access requests, and secure delivery of your protected resources.
Step-by-Step: Setting Up ACF for Content Gating
Let's walk through the process of configuring Gatekeeper Pro to utilise your ACF fields for content gating.
Step 1: Install and Activate Gatekeeper Pro and ACF Pro
If you haven't already, install and activate both the Advanced Custom Fields Pro plugin and the Gatekeeper Pro plugin. You can do this from your WordPress dashboard by navigating to Plugins > Add New, uploading the plugin files, and then activating them.
Once activated, Gatekeeper Pro will add a new top-level menu item to your WordPress admin sidebar, typically labelled "Gatekeeper Pro". ACF Pro will add a "ACF" menu item.
Step 2: Create Your ACF Field Group for Gating Settings
Next, we'll create an ACF field group to house our content gating options. This will provide a clean interface for content editors.
- Navigate to ACF > Field Groups in your WordPress admin.
- Click Add New to create a new field group. Give it a descriptive name, such as "Content Gating Settings".
- Add the following fields:
- Field 1: Lock Content
- Field Label: Lock Content
- Field Name:
gatekeeper_locked(It's recommended to use this specific field name for clarity, though you can use any unique name.) - Field Type: Checkbox
- Choices:
1 : Yes, lock this content - Default Value: Leave unchecked.
This checkbox will determine if the content is protected by Gatekeeper Pro.
- Field 2: Protected Resource
- Field Label: Protected Resource
- Field Name:
gatekeeper_resource(Again, using a descriptive field name is helpful.) - Field Type: File or URL
- Return Format (for File type): File Array (This is generally the most flexible for integration.)
- Conditional Logic (Optional but Recommended): Set this field to only show if "Lock Content" (
gatekeeper_locked) is checked. This keeps the interface clean.
This field will store the actual file or video URL that Gatekeeper Pro will protect. If you're gating a downloadable file, use a "File" field. If you're gating an external video or a specific URL, use a "URL" field. Gatekeeper Pro handles both scenarios.
- Field 1: Lock Content
- In the Location rules, specify where this field group should appear. For example, "Post Type is equal to Post" and "Post Type is equal to Page". You can add rules for any custom post types where you intend to gate content.
- Click Save Changes to save your new ACF field group.
Step 3: Configure Gatekeeper Pro to Use ACF Field Mapping
Now, we need to tell Gatekeeper Pro to look for your content gating settings in the ACF fields you just created.
- Navigate to Gatekeeper Pro > Settings in your WordPress admin.
- Click on the Post Types tab.
- You'll see a list of your public post types (e.g., Posts, Pages, custom post types). For each post type where you want to use ACF for content gating, follow these steps:
- Locate the desired post type (e.g., "Post").
- Under the "Field Source" column, select ACF Field Mapping from the dropdown menu.
- Click Save Changes at the bottom of the table to apply this setting.
Repeat this for all post types where you wish to utilise ACF for gating.
Step 4: Map Your ACF Fields to Gatekeeper Pro Functions
With "ACF Field Mapping" selected as the field source, new options will appear for each configured post type, allowing you to connect your custom ACF fields to Gatekeeper Pro's internal logic.
- Staying on the Gatekeeper Pro > Settings > Post Types tab, locate the post type you just configured for "ACF Field Mapping" (e.g., "Post").
- You will now see two new dropdowns:
- ACF Field: Locked: Select the ACF field that determines if content is locked. In our example, this would be
gatekeeper_locked. - ACF Field: Protected File/Video: Select the ACF field that contains the protected resource. In our example, this would be
gatekeeper_resource.
- ACF Field: Locked: Select the ACF field that determines if content is locked. In our example, this would be
- After selecting the appropriate ACF fields for each post type, ensure you click Save Changes at the bottom of the table.
Gatekeeper Pro's "Field Detector" feature will help by automatically listing available ACF fields for the selected post type, simplifying the mapping process.
Step 5: Apply Content Gating to a Post or Page
With your ACF fields created and mapped, you can now use them to lock content on your posts, pages, or custom post types.
- Navigate to Posts > Add New (or edit an existing post).
- Scroll down to find your "Content Gating Settings" ACF field group.
- Check the "Lock Content" checkbox. This tells Gatekeeper Pro that this specific post is to be protected.
- In the "Protected Resource" field:
- If you used an ACF File field, click "Add File" and upload or select the document you wish to gate. Gatekeeper Pro will automatically move this file to its secure, protected directory.
- If you used an ACF URL field, paste the URL of the video or external resource you want to protect. Gatekeeper Pro will then proxy access to this URL.
- Publish or Update your post.
Now, when a visitor attempts to access this post, Gatekeeper Pro will intercept the request and present the access request form or content gate, preventing direct access until an access token is approved.
Step 6: Display the Gated Content and Request Form
Gatekeeper Pro provides several ways to display your gated content and the access request form to visitors:
- Shortcodes: Use shortcodes like
[gatekeeper_gate]to wrap the content you want to hide, or[gatekeeper_request_form]to display the request form directly. For a complete resource card that includes a thumbnail, title, description, and an action button, use[gatekeeper_resource_card id="YOUR_POST_ID"]. - Elementor Widgets: If you're using Elementor, Gatekeeper Pro offers dedicated widgets such as "Content Gate", "Resource Card", "Gated Video", "Download Button", and "Request Form" for easy drag-and-drop implementation.
- PHP Template Tags: For theme developers, Gatekeeper Pro provides PHP template tags and direct class methods for deep integration into your custom templates.
When a user requests access and is approved, Gatekeeper Pro generates a secure, time-limited access token. This token allows the user to view or download the protected resource via a secure proxy endpoint, ensuring that direct URL access to the file or video is impossible.
Advanced Considerations and Best Practices
Choosing Field Types for Protected Resources
When defining your "Protected Resource" ACF field, consider the type of content you're gating:
- File Field: Ideal for downloadable documents, PDFs, software, or any file you upload to the WordPress Media Library. Gatekeeper Pro will move these to a secure directory and stream them.
- URL Field: Best for external videos (e.g., YouTube, Vimeo, private servers), external documents, or any content accessible via a URL that you want to proxy through Gatekeeper Pro's token validation system.
Conditional Logic for Enhanced UX
Always leverage ACF's conditional logic to hide the "Protected Resource" field unless "Lock Content" is checked. This significantly improves the content editing experience by only showing relevant options when needed.
Consistency Across Post Types
If you're gating content across multiple post types (e.g., Posts, Pages, 'Whitepapers' CPT, 'Training Videos' CPT), ensure your ACF field group is assigned to all relevant post types, and that you map the fields correctly in Gatekeeper Pro settings for each one.
Managing Access Requests and Tokens
Once your content is gated, Gatekeeper Pro's built-in workflow takes over. Administrators receive email notifications for new access requests and can approve or disapprove them directly from the email – no WordPress login required. Approved users receive an email with a secure access link (token), which can be configured with a specific Time-to-Live (TTL) or set for unlimited access. You can manage all requests and tokens from the Gatekeeper Pro admin dashboard.
Analytics and Reporting
Gatekeeper Pro also tracks access patterns for your gated content. Leverage the built-in analytics to understand who is requesting access, which resources are most popular, and export this data for your CRM or other marketing tools.
Conclusion
Leveraging Advanced Custom Fields for content gating with Gatekeeper Pro provides a robust, flexible, and developer-friendly solution for securing your valuable WordPress content. By defining your content restriction settings through ACF, you gain unparalleled control over the editorial experience, streamline workflows, and ensure a consistent approach across all your post types.
This approach moves beyond basic content locking, empowering you to build sophisticated gated content strategies for lead generation, client portals, exclusive resource access, or internal knowledge bases. With Gatekeeper Pro handling the secure delivery and access workflow, you can focus on creating exceptional content, confident that access is precisely managed.


