[![How to Show an Excerpt of Password-Protected Posts 1](https://coma.lv/wp-content/uploads/2024/11/Gemini_Generated_Image_6poy8k6poy8k6poy-2000px.webp)](https://coma.lv/wp-content/uploads/2024/11/Gemini_Generated_Image_6poy8k6poy8k6poy-2000px-1030x396.webp)

# How to Show an Excerpt of Password-Protected Posts

Nov 25, 2024/by [Vadim Pavlovich](https://coma.lv/en/author/djcoma/)

By default, WordPress does not show the content of password-protected posts until the user enters the password. However, there are several ways you can make protected posts show users a teaser or a short summary. In this article we will explain how this can be done.

## Method One: Manual

You need to copy and paste the following code into the functions.php file

function wpb_protected_excerpt( $excerpt ) { if ( post_password_required() ) { $post = get_post(); $excerpt=$post-&gt;post_excerpt; } return $excerpt; } add_filter( &#039;the_excerpt&#039;, &#039;wpb_protected_excerpt&#039; ); function wpb_protected_excerpt_posts( $content ) { if ( post_password_required() &amp;&amp; is_single() ) { $post = get_post(); return $post-&gt;post_excerpt.$content; }} add_filter( &#039;the_content&#039;, &#039;wpb_protected_excerpt_posts&#039;, 10 );

Now go to the Posts screen to edit your password-protected post and click the screen options button at the top of the screen. This will expand a menu with a bunch of settings. You need to make sure the Excerpt option is ticked.

![WordPress](https://coma.lv/wp-content/uploads/2016/11/excerptcheckbox.jpg)

This will display a meta box below the post editor where you can enter a summary of your post.

![WordPress](https://coma.lv/wp-content/uploads/2016/11/excerptwp.jpg)

Before publishing the post, make sure it is password-protected.

![WordPress](https://coma.lv/wp-content/uploads/2016/11/protected-post.jpg)

## Method Two: Using a Plugin

Using password-protected posts is not difficult, but it does not guarantee that the post will really be seen by those who are supposed to see it. If you have a multi-user site, it is better to use a plugin as a protection measure. In this case you will be able to control which users have access to protected posts and easily control how much content you want to show. Think of it as a site with multi-level subscriptions. To do this, first install and activate the Restrict Content Pro plugin. After activation, go to its settings (Restrict » Settings) to configure the plugin.

![WordPress](https://coma.lv/wp-content/uploads/2016/11/restrictedcontentmessage.jpg)

You will need to specify the message users will see when they cannot access the protected content. Then simply save the settings and create a new post or edit an old one that you want to protect. Just add the material and surround the part you want to hide with [restrict] [/restrict] tags.

![WordPress](https://coma.lv/wp-content/uploads/2016/11/restrictcontentshortcode.jpg)

**Important: you do not need to password-protect the post.**

You can also show an excerpt to all users and give access only to logged-in users using the Restrict Content meta box below the post editor. Just tick the box next to the excerpt and choose a user role. By choosing the subscriber role, you let all users registered on your site view your post. Guests will see only the excerpt.

![WordPress](https://coma.lv/wp-content/uploads/2016/11/subscriberonly.jpg)

## Selling Premium Content on Your Site

The plugin mentioned above also lets you sell subscriptions to premium content. You can accept payments with Stripe, PayPal and Braintree.

![WordPress](https://coma.lv/wp-content/uploads/2016/11/restrictcontentpayments.jpg)

You can create subscription packages that users can choose from when registering on your site. You can decide what content your users get depending on their subscription level. You can also have different subscription levels.

---

*Our specialization is WordPress website development and maintenance. Contact us for a free consultation — [vadim@coma.lv](mailto:vadim@coma.lv), [+371 29394520](tel:+37129394520)*

---
