Linux 软件免费装
Banner图

Deadbolt — Restricted Page Templates

开发者 apos37
更新时间 2026年11月6日 02:33
PHP版本: 8.0 及以上
WordPress版本: 7.1
版权: GPLv2 or later
版权网址: 版权信息

标签

access control members only restrict content user roles access denied

下载

1.0.1

详情介绍:

Most access plugins hide a page and show one generic "access denied" line. Deadbolt lets you decide who can view each page, post or custom post type, and then shows each blocked visitor a message written for them. Visitors who cannot view something are sent to your No Access Page. There, the plugin picks the template that best matches the page they tried to open and the reason they were stopped, and fills it in with links to log in, register, log out or try again. Who it's for Deadbolt controls who can view content. It does not take payments, sell memberships or create public-facing user profile pages. Access is based on standard WordPress roles and users, so it works with any plugin that assigns them. Customizable templates Templates are the heart of the plugin. Each one is a regular post you write in the block editor or the Classic Editor, with full formatting, images, buttons and columns. An overview of everything restricted The Pages screen counts the restricted content in each post type, split into Logged-In Only, Logged-Out Only, URL Parameter and Everyone. Expand a post type to list its restricted posts, their access and the templates blocked visitors will see. Flexible access rules Hide restricted content everywhere Restricted content is always protected when visited directly. You can also remove it, for anyone who cannot view it, from: Lightweight For developers Actions and filters are available on our developer docs. More from PluginRx See our other free plugins on WordPress.org or at pluginrx.com.

安装:

  1. Install the plugin from Plugins > Add New, or upload the deadbolt folder to /wp-content/plugins/.
  2. Activate the plugin through the Plugins screen.
  3. Go to Deadbolt > Settings and select or create your No Access Page. It must contain the [deadbolt] shortcode - creating this page from Settings automatically adds the shortcode.
  4. Under Post Types, enable the post types you want to control and choose their default access.
  5. Edit a post or page and choose who can view it in the Access box.
  6. Customize what blocked visitors see under Deadbolt > Templates.
  7. Check everything that is restricted under Deadbolt > Pages.
  8. ALWAYS test access to ensure it's working properly.

屏幕截图:

  • Writing a template in the block editor, with its settings and merge tags
  • The templates list, showing when and where each template applies
  • Settings
  • The Access box on the edit screen, with roles, specific users and the templates in use
  • The Access column, with templates shown, and Quick Edit
  • Menu item visibility

常见问题:

Why can visitors still view restricted pages?

Visitors are only redirected once a published No Access Page is selected under Deadbolt > Settings. Also check that the post type is enabled under Post Types.

How does the plugin choose which template to show?

When a visitor is redirected, the No Access Page looks at the restricted post, the link the visitor arrived with, and the reason they were blocked: they need to log in, they lack the required role or user access, they are logged in on a logged-out-only page, or their link does not match the page's URL Parameter rule. A template for that specific post wins over one for its post type, which wins over a global one. If nothing matches, a built-in default is used.

How does URL Parameter access work?

Choose URL Parameter as the access for a post, or as a post type's default, then enter a parameter name, a condition and a value. Visitors whose link matches can view the content, logged in or not, and everyone else is sent to the No Access Page and shown your "URL Parameter Not Met" templates. For example, "id is not" with no value requires links like ?id=123, while "ref is email" only opens the page from your email links. When hiding restricted content from archives, search, feeds, sitemaps and menus, links are checked without parameters, so the content is listed only if its rule matches an empty parameter. WordPress query names, such as p, s and page_id, can't be used.

Can I show a different message on one page?

Yes. In the Access box on that page, click "Create a unique template for this post". Alternatively, create a new template and choose "Specific Posts" as the Scope and choose the page you want. Then select "Follows each post's Access setting." You will still need to select the Access point on the page itself if you don't want it set to the default.

Which merge tags are available?

{login_link}, {login_url}, {logout_link}, {logout_url}, {register_link}, {register_url}, {retry_link}, {retry_url}, {home_link}, {home_url}, {post_title}, {post_url}, {required_roles}, {user_display_name} and {site_name}. The Merge Tags box on the template screen lists them all, and developers can add more with the deadbolt_merge_tags filter.

Will hiding restricted content work with my theme and plugins?

Restricted content is always protected when visited directly. The optional hiding features depend on how your theme and other plugins load content:

  • Archives, search and feeds cover queries made through WordPress, including Query Loop blocks and most page builder widgets. Content loaded with custom database queries, or with suppress_filters turned on, is not affected.
  • Front-end AJAX requests, such as "load more" buttons, are not filtered by default. Developers can add 'deadbolt_context' => 'archives' to the query arguments to include them.
  • XML sitemaps are supported for WordPress core, Yoast SEO, Rank Math, All in One SEO and SEOPress. Other sitemap generators may still list restricted content. Remember to clear your SEO plugin's sitemap cache after changing access.
  • Navigation menus work in Appearance > Menus and in the Navigation block. Menus built by page builders or other menu plugins may not be affected. The Customizer's menu editor does not show the visibility controls.
  • Previous/next links work with WordPress functions and blocks. Themes that build these links with their own queries may still show restricted posts, but those posts are still protected when clicked.

Is the hiding feature fast on large sites?

Yes. Access rules are kept in a single cached index, so no post meta joins are added to your queries. For the best performance, restrict whole post types with the default access and allow exceptions per post, rather than restricting thousands of posts one by one.

Does it work with caching plugins?

Restricted pages redirect before any content is sent, and the No Access Page tells caching plugins not to cache it. If a page cache serves logged-out visitors, clear it after changing access rules.

What happens to my data when I delete the plugin?

Nothing is removed unless you check "Remove All Plugin Data on Uninstall" under Settings > Advanced.

Where can I request features and get further support?

We recommend using our website support forum as the primary method for requesting features and getting help. You can also reach out via our Discord support server or the WordPress.org support forum, but please note that WordPress.org doesn’t always notify us of new posts, so it’s not ideal for time-sensitive issues.

更新日志:

1.0.1