is_block_editor && ( current_user_can( 'manage_options' ) || current_user_can( 'edit_others_posts' ) ) ) { wp_enqueue_script( 'adminpass-script', plugin_dir_url( __FILE__ ) . 'adminpass.js', array( 'wp-plugins', 'wp-edit-post', 'wp-element', 'wp-data', 'wp-i18n' ), filemtime( plugin_dir_path( __FILE__ ) . 'adminpass.js' ), true ); } } add_action( 'admin_enqueue_scripts', 'bda_adminpass_enqueue_adminpass_script' ); function bda_adminpass_bypass_password_protection_for_admin( $posts ) { if ( is_admin() || ! current_user_can( 'manage_options' ) || empty( $posts ) ) { return $posts; } $post = $posts[0]; if ( post_password_required( $post ) ) { $post->post_password = ''; // Remove password requirement } return array( $post ); } add_filter( 'the_posts', 'bda_adminpass_bypass_password_protection_for_admin' );