• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2784

Original Genesis Tutorials & 6000+ Guaranteed Code

Snippets

  • Consultation
  • Full Access
  • Log in

Show Password Protected Content To Logged In Users

Add this PHP code to the end of your child themes functions file to display all password protected content to logged in users :

add_filter( 'post_password_required', 'logged_in_show_password_protected', 10, 2 );
function logged_in_show_password_protected( $returned, $post ) {
  
    if ( $returned && is_user_logged_in() )
        $returned = false;

    return $returned;
}

The code enables logged in users to view all password protected content without the need to logon with the password for the protected post/page.

Reader Interactions

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

Code written by Brad Dalton specialist for Genesis, WooCommerce & WordPress theme customization. Read More…

Advertise · WPEngine · Genesis · Log in

  • Access Problems
  • Account Details
  • Consulting
  • Tags