2 Ways to Protect Partial WordPress Content

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 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

  1. Head to the post you intend to password protect partially in your WP dashboard
  2. Make sure the Custom Fields in the Screen Options section at the top of the post is enabled
    ppwp-custom-fields-screen-options
  3. Go to Custom Fields area at the bottom of the editing screen
  4. Put the “_always_visible_content” shortcode into the Name box
  5. Add the readable text of the post and page in the Value box
    ppwp_always_visible_content
  6. 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:

  1. Find the Visibility option on the right side of the screen
  2. Change the post status from Public to Password protected
  3. Enter your desired password
  4. Hit OK

ppwp-post-visibility

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

ppwp-password-protect-parts-content

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:

  1. Click on Password Protect WordPress icon on the sidebar to go to the Settings page
  2. Head to the Shortcodes tab
  3. Copy the shortcodes
    ppwp-partial-content-protection-shortcodes
  4. Go to Posts/ Pages and choose your desired post or page
  5. Enter the shortcode to the sections you’d like to hide from the public view
  6. 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:

  1. Go to Rules under MemberPress icon
  2. Choose Partial option in the Protected Content dropdown
  3. Click on Membership in Access Condition
    ppwp-memberpress-rules
  4. Save your rules
  5. Copy the shortcode [mepr-show if=“rule:13”][/mepr-show] in Partial Content Code section
    ppwp-short-code-protect-parts-content
  6. Head to your desired post
  7. Enter the shortcode to the section you want to protect
  8. 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.

ppwp-memberpress-shortcode-2

ppwp-memberpress-notification

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:

  1. Go to Rules under MemberPress icon
  2. Choose A Single Post under the Protected Content dropdown
  3. Type the post title in the box next to Single Post option
    ppwp-memberpress-singple-post
  4. Select More Tag in the Excerpts dropdown
  5. Save your rules
    ppwp-excerps-more-tag
  6. Head to the post you want to lock parts of the content
  7. Insert the More Tag above the sections you intend to hide
  8. Update the post
    ppwp-wordpress-more-tag

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.

ppwp-excerpt

Then, follow the 4 steps below:

  1. Copy the paragraphs which should be visible to all visitors
  2. Paste them in Excerpt box at the bottom of the editing screen
  3. Enter “This is an excerpt” at the top of the box
  4. 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.

Leave a Reply

Your email address will not be published. Required fields are marked *