
Gated Content Block for WordPress – Documentation
Overview
WP Gated Content Block provides a secure, server-side way to control access to content directly within the WordPress block editor.
Instead of hiding content with CSS or JavaScript after it has already loaded, this plugin prevents restricted content from being rendered at all. This ensures that protected content is never exposed in the browser, improves SEO integrity, and avoids issues with caching or front-end inconsistencies.
The plugin is designed to work as a structural control point inside your content, allowing you to define exactly where access should stop and what should be displayed instead.
Both the free and Pro versions share the same core behaviour, ensuring a consistent experience and seamless upgrades.
How It Works
The Gated Content block acts as a marker within your content flow rather than a traditional wrapper.
When a visitor reaches the block:
- If access is allowed, the block quietly disappears and the page continues rendering as normal, making the gate effectively invisible to permitted users.
- If access is not allowed, the block is rendered and everything that follows it is withheld from the output, ensuring restricted content is never included in the page markup.
This gives you precise control over:
- where gated content begins
- how much preview content is visible before restriction
- what messaging or layout appears when access is denied
Because the logic runs server-side, this behaviour is consistent across all themes, caching layers, and devices.
Free Features
Login-Based Content Gating (Free)
The free version allows you to restrict content based on whether a user is logged in or logged out, providing a simple but effective access control system.
You can configure the block to:
- allow only logged-in users to continue viewing content beyond the gate
- restrict logged-in users and instead show content only to visitors who are logged out (useful for login prompts or onboarding flows)
This makes it suitable for:
- member-only articles or resources
- gated blog content with preview sections
- prompting users to log in before continuing
- simple private content areas without additional plugins
The logic is applied instantly and does not rely on redirects or external systems.
Server-Side Rendering (Free)
All access control decisions are made before the page is delivered to the browser.
This ensures:
- restricted content is never present in the HTML source
- no reliance on front-end scripts to hide content
- compatibility with aggressive caching and CDN setups
- consistent behaviour regardless of browser or device
This approach is significantly more secure than CSS or JavaScript-based gating and avoids accidental exposure of protected content.
Block Editor Integration (Free)
The plugin is built specifically for the WordPress block editor, providing a native editing experience.
You can:
- insert the block using
/gated content - configure access rules directly in the inspector panel
- reposition the gate visually within your content
Because the block behaves like any other Gutenberg block, it fits naturally into existing workflows without introducing new concepts such as shortcodes or global settings panels.
Flexible Layout Support (Free)
The gated content block works alongside any core or custom block, allowing you to design layouts that match your content and branding.
You are not limited to a predefined structure. Instead, you can:
- combine Columns and Groups to create structured layouts
- add Buttons to guide users toward login or upgrade actions
- use the WordPress Login block to embed a login form directly within the gated area
- create visually distinct call-to-action sections that appear when content is restricted
Because the gate acts as a structural marker rather than a wrapper, you retain full control over how your gated experience looks and behaves.
Pro Features
User Role Restrictions (Pro)
The Pro version allows you to restrict content based on WordPress user roles, including custom roles created by other plugins.
This enables:
- tiered membership systems with different access levels
- content visibility based on editorial or organisational roles
- controlled access for clients, staff, or contributors
You can define exactly which roles are allowed or excluded, making it easy to tailor content access across different user groups.
WooCommerce Product Ownership (Pro)
Content can be restricted based on whether a user has purchased a specific WooCommerce product.
This allows you to:
- deliver premium content after purchase
- provide access to downloads, tutorials, or resources tied to a product
- create simple paywall-style experiences without additional systems
The integration works directly with WooCommerce data, ensuring accurate and reliable access control.
WooCommerce Subscriptions (Pro)
The Pro version supports gating content based on active WooCommerce subscriptions.
This is particularly useful for:
- recurring membership sites
- subscription-based content platforms
- premium libraries or ongoing services
Access is automatically tied to subscription status, so users retain or lose access as their subscription changes.
User Meta Conditions (Pro)
Advanced gating can be implemented using user metadata.
This allows you to:
- create custom rules based on stored user data
- integrate with external systems or plugins that store metadata
- build highly tailored access conditions
For example, you can restrict content based on user preferences, account status, or any custom field stored in user meta.
Extensible Gating Logic (Pro)
Developers can extend and customise gating behaviour using filters and custom logic.
This enables:
- integration with bespoke systems
- conditional logic beyond standard UI controls
- fine-grained control over access decisions
The architecture is designed to be predictable and easy to extend, making it suitable for complex or large-scale implementations.
Seamless Upgrade from Free to Pro
Upgrading from the free version to Pro is designed to be effortless and risk-free.
- Existing gate blocks continue to function without modification
- No content migration or restructuring is required
- All previously configured layouts remain intact
- The Pro plugin automatically replaces and extends free functionality
This ensures that you can start simple and expand functionality over time without disrupting your content or workflow.
Developer Documentation
WP Gated Content Block is built with clean, extensible logic, allowing developers to integrate and customise behaviour easily.
Core Gating Filter
This filter allows you to control whether access should be granted.
apply_filters( 'crispycohd_gc_is_allowed', $allowed, $context );
Parameters:
$allowed(bool) — The current access decision$context(array) — Includes block attributes, user state, and environment data
Example:
add_filter( 'crispycohd_gc_is_allowed', function( $allowed, $context ) {
if ( current_user_can( 'manage_options' ) ) {
return true;
}
return $allowed;
}, 10, 2 );
This can be used to override access for administrators or inject custom business logic.
Modify Gate Output
This filter allows you to customise what is rendered when access is denied.
apply_filters( 'crispycohd_gc_render_block', $output, $attributes, $context );
You can use this to:
- change messaging dynamically
- inject additional markup or components
- integrate external systems or templates
Force Access Override
This filter allows you to globally allow or deny access in specific scenarios.
add_filter( 'crispycohd_gc_force_access', function( $override ) {
if ( defined( 'WP_CLI' ) && WP_CLI ) {
return true;
}
return $override;
});
This is useful for:
- CLI operations
- debugging environments
- temporary overrides during development
Best Practices
When extending gating logic:
- Keep logic lightweight to avoid performance issues
- Avoid database-heavy operations inside filters
- Cache results where possible
- Ensure consistent return values for predictable behaviour
- Test thoroughly in both logged-in and logged-out states
Summary
WP Gated Content Block delivers a secure, flexible, and modern approach to content restriction within WordPress.
The free version provides a strong foundation for login-based gating, while the Pro version expands this into a comprehensive access control system suitable for memberships, e-commerce, and advanced use cases.
By combining server-side rendering with a block-native workflow, the plugin ensures reliability, security, and ease of use across all types of WordPress sites.
