Categories
Free Tutorials Genesis Tutorials

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.

Leave a Reply

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