wordpress check if page is password protected

Solutions on MaxInterview for wordpress check if page is password protected by the best coders in the world

showing results for - "wordpress check if page is password protected"
Christian
24 Jun 2017
1//post id is optional
2if(post_password_required($post_id)) {}
3//or
4if(!empty($post->post_password)){
5   // do some stuff
6}