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.

Was This Tutorial Helpful?

Free

$0

Access only to all free tutorials per month.



Monthly

$75

Access to 10 premium tutorials per month.


Tutorial Request


Includes code guarantee and coding support.

Yearly

$500

Access to 15 premium tutorials per month.


Monthly Tutorial Request


Includes code guarantee and priority coding support.