wordpress check if page is password protected
<?php
// Step 1: Use the WordPress function to check if the current page is password protected.
if ( post_password_required() ) {
// Step 2: If the page is password protected, do something here.
echo 'This page is password protected.';
} else {
// Step 3: If the page is not password protected, do something else here.
echo 'This page is not password protected.';
}
?>