Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Hide password protected posts, for non-admins, in the case of 'edit-post' screen id
- */
- add_action( 'pre_get_posts', function( WP_Query $q )
- {
- $screen = get_current_screen();
- if( is_admin()
- && ! current_user_can( 'manage_options' )
- && is_a( $screen, WP_Screen )
- && 'edit-post' === $screen->id
- )
- $q->set( 'has_password', false );
- } );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement