Skip to content
WordPress.org
  • Showcase
  • Plugins
  • Themes
  • Hosting
  • News
    • Learn WordPress
    • Documentation
    • Education
    • Forums
    • Developers
    • Blocks
    • Patterns
    • Photos
    • Openverse ↗︎
    • WordPress.tv ↗︎
    • About WordPress
    • Make WordPress
    • Events
    • Five for the Future
    • Enterprise
    • Gutenberg ↗︎
    • Job Board ↗︎
    • Swag Store ↗︎
  • Get WordPress
Get WordPress
WordPress.org

Plugin Directory

Codifigata – Content Login Gate

  • Submit a plugin
  • My favorites
  • Log in
  • Submit a plugin
  • My favorites
  • Log in

Codifigata – Content Login Gate

By Francesco Campus
Download
  • Details
  • Reviews
  • Installation
  • Development
Support

Description

Codifigata – Content Login Gate lets you restrict the entire content of a post/page, or just part of it (for example download buttons), to logged-in users, showing a login button to logged-out visitors in place of the restricted content.

Two usage modes

  1. Gate the entire content — enable it with a simple checkbox in the “Restricted access” meta box, shown in the editor sidebar for posts and pages.
  2. Gate a specific area — using the [cdfg_login_gate]...[/cdfg_login_gate] shortcode, which can be added in the Gutenberg “Shortcode” block. Useful for hiding only one section of the content (e.g. download buttons) while keeping the rest of the post visible.

Two display modes (Settings → Content Login Gate)

  • Blur the content — the content stays in the page but is visually blurred via CSS, with an overlay and a login button. Effective as a preview/registration nudge, but it is not real protection: anyone who views the page source can still read the content.
  • Hide the content — the restricted content is not included in the HTML sent to logged-out users: only the login button appears on the page. Recommended for genuinely sensitive content (download links, private information, etc.).

Features

  • Works right after activation, with sensible defaults.
  • Settings page with a color picker to customize the button’s background color, text color, and label, without writing code.
  • CSS is only loaded on pages where the gate is actually active (no impact on pages without restricted content).
  • Customizable login page URL, with automatic redirect back to the original content after login.
  • Supported post types customizable via a PHP filter.
  • min_height and label shortcode attributes to customize each individual restricted area.

Developer filters

cdfg_login_url (string $login_url, string $redirect)

Filters the base URL of the login page. Default: home_url( '/login/' ).

cdfg_button_label (string $label)

Filters the default label of the login button.

cdfg_post_types (array $post_types)

Filters the list of post types on which the “Restricted access” meta box is shown. Default: array( 'post', 'page' ).

Example:

add_filter( 'cdfg_login_url', function( $url, $redirect ) {
    return home_url( '/sign-in/' );
}, 10, 2 );

add_filter( 'cdfg_post_types', function( $post_types ) {
    $post_types[] = 'product';
    return $post_types;
} );

Installation

  1. Upload the plugin folder to /wp-content/plugins/, or install it from the WordPress “Plugins” screen.
  2. Activate the plugin from the WordPress “Plugins” menu.
  3. (Optional) Go to Settings → Content Login Gate to choose the display mode (blur/hide) and customize the button’s colors and label.
  4. (Optional) Create a custom login page and set its URL with the cdfg_login_url filter; otherwise the plugin defaults to /login/.
  5. To gate the entire content: open a post or page, enable the “Require login to view the content” checkbox in the “Restricted access” meta box, and save.
  6. To gate just one area: in the block editor, add a “Shortcode” block with [cdfg_login_gate]...[/cdfg_login_gate] around the content you want to restrict.

FAQ

Does the plugin work with any theme?

Yes. The gate is applied through the the_content filter and through the shortcode, so it works with any theme that uses standard WordPress functions to output content.

Can I use the shortcode on post types other than posts and pages?

Yes, the [cdfg_login_gate] shortcode works anywhere do_shortcode() is executed (content, widgets that support shortcodes, etc.). The “entire content” meta box, however, is limited to the post types filterable with cdfg_post_types.

How do I customize the button label for just one area?

Add the label attribute to the shortcode, for example: [cdfg_login_gate label="Unlock download"]...[/cdfg_login_gate].

What is the security difference between “blur” and “hide”?

With “blur the content”, the restricted content is still present in the page’s HTML and is only visually hidden via CSS: anyone who views the page source, disables CSS, or makes a direct request to the page can still read it. It is meant as a preview/registration nudge, not as protection. With “hide the content”, the restricted content is not included in the HTML generated for logged-out users: only the button markup is sent instead. Use this second mode for genuinely sensitive content.

Is the restricted content exposed in RSS feeds?

No, regardless of the selected mode. In feeds, where the CSS overlay is not available, the plugin always replaces the restricted content with a short text notice and a link to the login page.

What happens to the plugin’s data on uninstall?

On uninstall (not on simple deactivation), the plugin removes the post meta that marks restricted content and the settings option (mode, colors, button label). No database tables are created.

Reviews

There are no reviews for this plugin.

Contributors & Developers

“Codifigata – Content Login Gate” is open source software. The following people have contributed to this plugin.

Contributors
  • Francesco Campus

Translate “Codifigata – Content Login Gate” into your language.

Interested in development?

Browse the code, check out the SVN repository, or subscribe to the development log by RSS.

Changelog

1.3.0

  • Renamed the [login_gate] shortcode to [cdfg_login_gate] to avoid collisions with other plugins/themes.
  • Removed bundled translation files; translations are now handled entirely through translate.wordpress.org.
  • Hardened shortcode output sanitization while preserving support for core Gutenberg blocks (Embed, Search, Social Icons, etc.).

1.2.0

  • Added the Settings page (Settings → Content Login Gate) with a color picker for background color, text color, and default button label.
  • Added the “hide the content” display mode: restricted content can now be fully excluded from the HTML sent to logged-out users, instead of only being blurred via CSS.

1.1.0

  • First version published on WordPress.org.
  • Gate the entire content via meta box, and a partial gate via the [cdfg_login_gate] shortcode.
  • Developer filters: cdfg_login_url, cdfg_button_label, cdfg_post_types.
  • Gate CSS loaded only when needed; dedicated handling for RSS feeds.

Meta

  • Version 1.3.0
  • Last updated 9 hours ago
  • Active installations Fewer than 10
  • WordPress version 5.8 or higher
  • Tested up to 7.0.2
  • PHP version 7.4 or higher
  • Tags
    content-protectionloginmembershiprestrict contentshortcode
  • Advanced View

Ratings

No reviews have been submitted yet.

Your review

See all reviews

Contributors

  • Francesco Campus

Support

Got something to say? Need help?

View support forum

  • About
  • News
  • Hosting
  • Privacy
  • Showcase
  • Themes
  • Plugins
  • Patterns
  • Learn
  • Documentation
  • Developers
  • WordPress.tv ↗
  • Get Involved
  • Events
  • Donate ↗
  • Five for the Future
  • WordPress.com ↗
  • Matt ↗
  • bbPress ↗
  • BuddyPress ↗
WordPress.org
WordPress.org
  • Visit our X (formerly Twitter) account
  • Visit our Bluesky account
  • Visit our Mastodon account
  • Visit our Threads account
  • Visit our Facebook page
  • Visit our Instagram account
  • Visit our LinkedIn account
  • Visit our TikTok account
  • Visit our YouTube channel
  • Visit our Tumblr account
Code is Poetry
The WordPress® trademark is the intellectual property of the WordPress Foundation.