check wordpress post visibility

 //check post visibility

if(get_post_status(932) == ‘publish’){
if(post_password_required(932)) {
$postStatus = ‘password protected’;
}
else{
$postStatus= ‘public’;
}
}else{
$postStatus = ‘private’;
}

if($postStatus){
echo $postStatus;
}

Leave a Comment

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