Running 34% of the entire internet, WordPress is considered as the biggest Content Management System in the world. You own a WordPress site, then your site is a sitting target of spammers and hackers. That’s why the term “content protection” becomes more and more common.
There are a number of solutions that can handle the job, but membership and password protection win the largest share. Both methods prove useful in their own ways.
Before digging into how these 2 solutions lock parts of your content, let’s talk about reasons for securing a portion of a post first.
- Why protecting sections of a page or post
- 2 Ways to Protect Sections of Content
Why Protecting Parts of a WordPress Page and Post
There must be a reason for WordPress site owners to display some sections while covering the rest of a post.
Imagine that you offer premium content and don’t want all types of visitors to access it. However, hiding the whole post content doesn’t give visitors a chance to find out what the page or post mentions and whether it’s worth entering their emails. That’s where protecting a portion of the content comes in handy.
The displayed paragraphs provide some hints of what the post is about while the hidden content makes readers curious. You can then ask them to subscribe or pay to see the complete content.
#1. Password Protect Parts of Your Content
Despite offering a built-in password protection feature, WordPress doesn’t allow you to block some sections of your content. So, you have to either manually add shortcodes to the post or use a third-party plugin.
Manually Secure Potions of Your Content with a Password
You need to take 2 main steps to password protect parts of your content, including:
- Make some sections of that post always visible to the public with a shortcode
- Lock the entire post with the built-in password protection option
Step 1: Add “_always_visible_content” shortcode
- Head to the post you intend to password protect partially in your WP dashboard
- Make sure the Custom Fields in the Screen Options section at the top of the post is enabled
- Go to Custom Fields area at the bottom of the editing screen
- Put the “_always_visible_content” shortcode into the Name box
- Add the readable text of the post and page in the Value box
- Enter the following code to your single.php file
while ( have_posts() ) { the_post(); if ( post_password_required( $post ) ) { print '<h1 class="post-protect-notice">' . __( 'Protected Post', 't5_theme' ) . '</h1>'; the_excerpt(); // custom field print wpautop( get_post_meta( get_the_ID(), '_always_visible_content', TRUE ) ); } else { // show regular content } }
Step 2: Protect the post or page with a password
It’s really easy to password protect pages and posts. Go to the editing screen of your desired post, then:
- Find the Visibility option on the right side of the screen
- Change the post status from Public to Password protected
- Enter your desired password
- Hit OK
Although the whole post is supposed to be secured with a password, the content sections inserted the shortcode “_always_visible_content” are always visible to the public.
If you’re not a coding wiz, this method might not be a perfect choice. It’s unfriendly to users and requires programming skills. In addition, you can only enter readable text in the Value box of the custom field. This means that images or videos are disallowed to be included in the visible content section. In this case, let’s turn to a third-party plugin for help.
Use Password Protect WordPress Pro Plugin
Password Protect WordPress Pro plugin offers a great solution to protect a portion of your content.
Once installed, the plugin will be inserted into your WordPress navigation menu. The following 4 steps guide you on how to start partially securing your desired posts and pages with a password:
- Click on Password Protect WordPress icon on the sidebar to go to the Settings page
- Head to the Shortcodes tab
- Copy the shortcodes
- Go to Posts/ Pages and choose your desired post or page
- Enter the shortcode to the sections you’d like to hide from the public view
- Remember to replace the words “password1 password2” with your own passwords.
It’s possible for you to lock a page or post with multiple passwords. For example, you want to protect sections of a post with 3 passwords: a!b!c!, 5fcb@0, and changeme!. Then, my shortcode will look something like this:
[ppwp id=”” class=”” passwords=“a!b!c!, 5fcb@0, changeme!” whitelisted_roles=“administrator, editor”] Your protected content [/ppwp]
The whitelisted_roles are able to access the content without entering the passwords. There are many other roles such as Author, Member, Logged-in User, or any custom roles. If you’d like everybody to fill in the password forms, just eliminate the whitelisted_roles section.
Beside partial content protection, the plugin also comes with other handful and outstanding features. You can protect not only single pages and posts but also the entire website. What’s more, you can shield a page and all of its sub-pages or child pages under it at the same time.
#2. Use MemberPress Plugin to Partially Protect Your Content
Besides plenty of functionalities, MemberPress can also help cover some sections of your posts. There are 3 ways to shield portions of your content with this plugin: inserting a shortcode, adding More tag, and using excerpts.
Insert Shortcode
Upon installation and activation, the MemberPress icon shows up in the left-hand navigation bar in your WordPress dashboard. You can follow this 8-step guide to start securing parts of your posts:
- Go to Rules under MemberPress icon
- Choose Partial option in the Protected Content dropdown
- Click on Membership in Access Condition
- Save your rules
- Copy the shortcode [mepr-show if=“rule:13”] … [/mepr-show] in Partial Content Code section
- Head to your desired post
- Enter the shortcode to the section you want to protect
- Hit Update
Once protected, only sections outside the shortcode are visible to the public. However, visitors are not notified that the rest of the content is hidden, which causes confusion. They might think the content is incomplete. That’s why you need to add another shortcode of unauth=“both” next to the existing shortcode to show a notification message.
Although the shortcode method can effectively shield portions of your content, it’s not highly recommended since there’s a lot of copy-paste. You can consider the More Tag solution which is cleaner and quicker to use.
Add More Tag
More Tag feature, built by WordPress, is primarily used to show a continuous reading link. For MemberPress users, this method also proves useful to protect sections of the content.
The guide below shows you how to add the More Tag to lock portions of your content:
- Go to Rules under MemberPress icon
- Choose A Single Post under the Protected Content dropdown
- Type the post title in the box next to Single Post option
- Select More Tag in the Excerpts dropdown
- Save your rules
- Head to the post you want to lock parts of the content
- Insert the More Tag above the sections you intend to hide
- Update the post
After inserting More Tag, content sections above it will be shown to the public while the rest will be covered. Only members with the correct login information are authorized to access the protected content.
Use Excerpts
Last but not least, Excerpts solution allows you to blanket sections of your content too. Before applying this method, make sure you tick the Excerpt box in the Screen Options.
Then, follow the 4 steps below:
- Copy the paragraphs which should be visible to all visitors
- Paste them in Excerpt box at the bottom of the editing screen
- Enter “This is an excerpt” at the top of the box
- Update the post
If unauthorized visitors access the post, they will see a message telling that they’re not allowed to view the rest of the content.
Ready to Protect Portions of Your Content?
While it’s easy for WordPress site owners to protect individual pages and posts, locking partial content raises some tricky questions.
There are 2 different paths you can take to hide portions of your content, either assigning a password or using a membership plugin. It’s possible for you to try different methods under each solution as well.
While MemberPress plugin proves effective for content owners to manage users and the protected content, Password Protect WordPress Pro is easier for users to view the hidden sections since they don’t have to log in or register.
Download Password Protect WordPress Pro today lock portions of your WordPress pages and posts.