The post_lock_lost_dialog WordPress action fires inside the dialog displayed when a user has lost the post lock. It helps customize the dialog box or add additional content.
Usage
add_action('post_lock_lost_dialog', 'your_custom_function', 10, 1);
function your_custom_function($post) {
  // your custom code here
}
Parameters
$post(WP_Post): The post object for which the lock is lost.
More information
See WordPress Developer Resources: post_lock_lost_dialog
Examples
Display a custom message
Add a custom message when the post lock is lost.
add_action('post_lock_lost_dialog', 'custom_lost_lock_message', 10, 1);
function custom_lost_lock_message($post) {
  echo "<p><strong>Note:</strong> Remember to save your work regularly to avoid losing it.</p>";
}
Log the lost post lock event
Log the lost post lock event to a custom log file.
add_action('post_lock_lost_dialog', 'log_lost_post_lock', 10, 1);
function log_lost_post_lock($post) {
  error_log("Post lock lost for post ID: " . $post->ID . "\n", 3, "/var/www/html/wp-content/lost_post_lock.log");
}
Notify admin via email
Send an email to the admin when a post lock is lost.
add_action('post_lock_lost_dialog', 'notify_admin_lost_post_lock', 10, 1);
function notify_admin_lost_post_lock($post) {
  $admin_email = get_option('admin_email');
  $subject = "Post lock lost for post ID: " . $post->ID;
  $message = "A user has lost the post lock for post ID: " . $post->ID;
  wp_mail($admin_email, $subject, $message);
}
Show custom JavaScript alert
Display a custom JavaScript alert when the post lock is lost.
add_action('post_lock_lost_dialog', 'custom_lost_lock_js_alert', 10, 1);
function custom_lost_lock_js_alert($post) {
  echo "<script>alert('You have lost the post lock for post ID: " . $post->ID . "');</script>";
}
Add custom CSS to the lost lock dialog
Style the lost lock dialog with custom CSS.
add_action('post_lock_lost_dialog', 'custom_lost_lock_css', 10, 1);
function custom_lost_lock_css($post) {
  echo "<style>
          .post-lock-dialog .notification-dialog {
            background-color: #f8d7da;
            border-color: #f5c6cb;
          }
        </style>";
}