Privatize parts of posts from unauthorized users. Begin protected content with [protected] and end hidden content with [/protected].
We often wish to provide some teaser content to visitors while keeping a part of the content reserved for registered users so that they will be lured to register on our site. This plugin helps you achieve exactly this. You will be able to mark a part of your post as private and the rest will be available to public and a login form OR a register and login will appear where your privatized content is supposed to appear. Once the user logs in they will be able to see the whole content (Great for membership sites). Now you can show off parts of your site to visitors and reserve parts for registered users.
How do I hide part of a post?
Put the part between the two tags:
Everyone can read this.
[protected]Only logged-in users can read this.[/protected]
Everyone can read this too.
Can I use it more than once on a page?
Yes. Every [protected] … [/protected] pair is handled on its own.
What do logged-out visitors see? Can I change the text?
By default, a short line asking them to log in, followed by a login form. In Settings > WP Private you can choose a login form, login and register links (the register link appears only when your site allows registration), or nothing at all, and you can write the HTML shown before and after the prompt.
Where does the visitor go after logging in?
Back to the same post, also on sites installed in a subdirectory.
Can I show a login link instead of a form? Can I use my own login page?
Yes to both, in Settings > WP Private. The shortcode [loginform] shows a login form anywhere in a post or page. Logged-in users see a greeting and a logout link instead.
Can I stop a specific logged-in user from seeing protected parts?
Yes. Add the user to the block list in Settings > WP Private. Blocked users see the message you write there instead of the content.
Does it work with the block editor?
Yes: put the shortcode in a Shortcode block or in paragraph text. A dedicated block is planned.
Is the hidden text really hidden?
From logged-out visitors, in the places listed in “What is protected” above. Read the search row of that table: a search can still return the post, though never the hidden text. Plugins that read raw post content are not controlled by WP Private.
Does it work with caching plugins?
Page caches normally serve cached pages to logged-out visitors only, which is the case the gate is built for. Tested configurations will be listed in a later release.
I updated from 1.x and the login form moved. Why?
From 2.0.0 the login form appears inside the post, where the hidden part is, instead of at the top of the page. Your [protected] shortcodes are unchanged and your settings were moved to a new format automatically when the plugin first ran.
I used “ comments in version 1.4 or 1.5. Do they still hide content?
No. Comment-style markers stopped working in 1.6 and do not work in 2.x. Content that you hid that way is visible. Replace the markers with [protected] and [/protected].
Can I go back to 1.6.1?
Going back to 1.6.1 is not supported. If you do it, [protected] still hides content, but 1.6.1 reads the settings as they were at the moment you upgraded, so changes made in 2.x, including the block list, do not apply. On a site first installed on 2.x, 1.6.1 hides protected parts from everyone until its settings are saved. Going forward to 2.x again keeps your 2.x settings and ignores edits made in 1.6.1.
What happens to my content if I remove the plugin?
The shortcode stops working and the hidden text becomes visible, together with the shortcode tags. Remove the tags and review the content before you delete the plugin.
What does the plugin leave behind if I delete it?
Its options stay in the database, so reinstalling restores your settings. Nothing is deleted on upgrade or on deletion. The options are:
wp_private_version
wp_private_settings_type
wp_private_settings_before_html
wp_private_settings_after_html
wp_private_settings_authorized_text
wp_private_settings_blocked_users
wp_private_settings_custom_login_page_url
Options written by versions 1.x are also left as they were, and 2.x no longer reads them after the one-time conversion: wp_private_settings, wp_private_replacement_type, wp_private_before_html, wp_private_after_html, wp_private_not_authorized_text, wp_private_selected_users, wp_private_custom_login_page_url and wp_private_linkback_enable. To remove them, delete them by hand (for example with WP-CLI: wp option delete wp_private_version).
Why was some of my HTML removed when I saved the settings?
Settings that accept HTML are filtered with the same rules as post content for users who do not have the unfiltered_html capability (for example administrators on multisite sub-sites). Administrators with that capability can save any markup. HTML you saved with an earlier version is output as stored until you change it.
The search finds a post with hidden text. Is that a bug?
It is a known limit. WordPress searches the stored text of a post, including the hidden part. A search for a word that appears only in the hidden part returns the post, and shows its title and the visible text, never the hidden part. A fix is planned for a later release.
How do I report a security problem?
Please do not post it in the support forum. Email security@smartlogix.co.in. A policy is in SECURITY.md in the plugin’s repository.