是的,WP中有一个功能:wp_check_post_lock()
给它一个帖子ID,它将返回当前正在编辑帖子的用户ID,如果没有人编辑帖子,它将返回false(即未锁定)。
$is_locked = wp_check_post_lock( $post_id );
if ( false === $is_locked ) {
// Post $post_id is not not locked for editing
} else {
// Post is not locked, $is_locked contains the user ID who is editing.
$user = get_user_by( \'id\', $is_locked );
echo \'Post id being edited by \' . $user->user_login;
}