function my_get_password( $id ) { $post = get_post( $id ); if ( !empty( $post->post_password ) ) { return $post->post_password; } return null; }