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.

Secure Potions of Your Content with a Password Manually

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 this case, let’s turn to a third-party plugin for help.

Use Passster Plugin

Passster provides a complete solution to partially lock your WordPress content. All you need to do is add a simple shortcode to the content sections that you’d like to restrict access to. Upon installation, you need to:

  1. Head to Plugin then Add new
  2. Search for Passster, click Install Now to add the plugin, then hit Activation
  3. Open the post you want to password protect part of the content
  4. Select the text section you’d like to protect
  5. Click on the Content Protector Shortcode option on the editor toolbar
    ppwp-passster-protected-post
  6. Enter a password in the pop-up screen
  7. Click INSERT SHORTCODE button to proceed
  8. Hit Update or Publish button to save your changes

Once protected, the private section is wrapped by the shortcode: [content_protector password=”your-password”]Your password-protected content[/content_protector]. It won’t be displayed unless a password is entered.

Use Password Protect WordPress Pro Plugin

Another great solution to protect a portion of your content is using Password Protect WordPress Pro plugin.

ppwp-password-protect-parts-content

Once installed, you can start partially securing your desired posts and pages with a password.

Compared to Passster which helps secure parts of a page or post only, Password Protect WordPress comes with more fruitful features in many other cases. You can protect not only single pages and posts but also the entire website. It’s possible for you to protect a page or post with multiple passwords too. What’s more, you can shield a page and all sub-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, 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 password protection plugins focus on password protecting parts of content only, MemberPress plugin proves useful in many other cases. You can insert shortcode, add More Tag, or even use Excerpts.

Please leave a comment below if you have any questions on how to partially hide your WordPress content.

Leave a Reply

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