wordpress function require password on page code example
Example: password required wp
//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
}