Title: Display password protected posts only
Last modified: May 24, 2022

---

# Display password protected posts only

 *  [alphamike2](https://wordpress.org/support/users/alphamike2/)
 * (@alphamike2)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/display-password-protected-posts-only/)
 * Dear all,
 * I’m willing to display password protected posts only (and no other post 🙂 ) 
   any idea on which filter to use in the following code :
 * $wpb_all_query = new WP_Query( array(‘post_type’=>’post’
 * Thanks !

Viewing 1 replies (of 1 total)

 *  [Vagelis](https://wordpress.org/support/users/eboxnet/)
 * (@eboxnet)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/display-password-protected-posts-only/#post-15675556)
 * Hi there, what you’re looking for is the has_password parameter.
    Set it to true
   to get only the ones with a password.
 * `new WP_Query( array( 'post_type' => 'post', 'has_password' => true ) );`
 * You can read more here:
    [https://developer.wordpress.org/reference/classes/wp_query/](https://developer.wordpress.org/reference/classes/wp_query/)

Viewing 1 replies (of 1 total)

The topic ‘Display password protected posts only’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [Vagelis](https://wordpress.org/support/users/eboxnet/)
 * Last activity: [3 years, 11 months ago](https://wordpress.org/support/topic/display-password-protected-posts-only/#post-15675556)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
