Bypass a WordPress Password Protected Page via url

In case somebody needs help about my topic, I’ve fixed the notice error by modifying the original code as following:

// BYPASS PASSWORD PRETECTED PAGE URL
add_filter( 'post_password_required', function( $returned, $post ) {   
if ( !is_admin() ) {
    if (strpos($_SERVER['REQUEST_URI'], 'pwd') !== false){  
        if( $returned && ( $_GET['pwd'] ==  $post->post_password ) )
            $returned = false;          
    }   
} else {        
    $returned = true;   
}
return $returned;
}, 10, 2 );