Skip to content

Instantly share code, notes, and snippets.

@braddalton
Last active December 21, 2021 07:30
Show Gist options
  • Save braddalton/bfc099559bec0b7fc97c to your computer and use it in GitHub Desktop.
Save braddalton/bfc099559bec0b7fc97c to your computer and use it in GitHub Desktop.
add_filter( 'body_class', 'add_password_protected_body_class' );
function add_password_protected_body_class( $classes ) {
if ( post_password_required() )
$classes[] = 'password-protected';
return $classes;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment