check post password wordpress code example
Example: wordpress check if page is password protected
//post id is optional
if(post_password_required($post_id)) {}
//or
if(!empty($post->post_password)){
// do some stuff
}
//post id is optional
if(post_password_required($post_id)) {}
//or
if(!empty($post->post_password)){
// do some stuff
}