Yes, there is a function in WP for that: wp_check_post_lock()
Give it the post ID and it will return the user ID that is currently editing the post OR false if no one is editing the post (i.e. it is not locked).
$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;
}
Related Posts:
- Custom user profile, registration, login page with theme
- How do I create a custom role capability?
- How to check username/password without signing in the user
- Add Custom User Capabilities Before or After the Custom User Role has Been Added?
- WordPress REST API call generates nonce twice on every call
- How to use WP default post list tables in a plugin?
- How to add quick edit and bulk edit fields to users admin section
- Why is the reset password key missing in the reset password email?
- Generating User(s) with Settings API
- WordPress admin deleted user details not removed in database. How to delete WordPress Users from Database
- Print WordPress username id inside JavaScript
- Function Get User Object By Username?
- How to get the ID of the currently logged in user?
- Modify users.php page to create page/post on button clicked
- Subscribe to author?
- How to filter users list on user_status field with get_users()
- Frontend language per user
- Display custom fields in frontside user profile
- How to restrict access to image folder depending on whether product is purchased or not?
- global $current_user not current user
- Display list of uploaded images, filtered by user under a specific user group
- What is the proper way to get logged in user id in a plugin?
- How to build a fool proof AdSense revenue sharing model?
- Hide custom post type by user roles
- How do I have now a duplicated user entry if this is not allowed (and I cannot replicate it)?
- How to allow only two (or more) users access to a plugin
- How can I create a custom plugin that allows anonymous users to signup without registering?
- First and last name fields not filled when using wp_insert_user
- Wp-admin Custom User Management
- get author of published post
- How to get custom post_author?
- Associate multiple email addresses with the same user account, so they can log in with either
- Update a user profile via frontend
- Best practice for Designing a Plugin with this scenario
- Adding another field to user table
- how to get the top 10 popular blogs
- How can I change my assigned user role in WordPress 3.5.1?
- How to relate the Category to user?
- User Data Handling between two plugins
- Adding a dropdown on the user admin
- Allowing duplicating users with same user_login and user_email
- Why User_login key doesn’t work with wp_update_user()
- How to grab data after wp user search is complete
- How to prevent users from deleting their accounts?
- User Registration Moderate
- How to retrieve custom profile fields associated with different users
- Upgrade routine: Interaction with user confirmation
- How do I control the list of Pages an author can see?
- Multiple Users Logged In Causing Incorrect Account Returned
- first_name property missing inside register_user action hook
- user can login from single account detail from multiple locations(computer) at the same time [closed]
- Create Unique and Customized User ID for Website Members in WordPress
- Which hook should be used to add an action containing a redirect?
- Is it worth checking if class_exists when developing a plugin and how to do it?
- the_content after all shortcodes are parsed
- How do I resolve Notice: Undefined offset: 0 in /wp-includes/capabilities.php on line 1145
- Pass javascript result to shortcode executer function
- URLs of plugin resources?
- anything like add_meta_box for categories?
- Can we create a category list page in WordPress?
- How to include class from addon after to be sure one class exists in the main plugin?
- WordPress: After Gutenberg plugin migration to block.json the localization/ translations with PolyGlot in JavaScript does not work anymore
- What is the Difference between directly call a function and call a function using add_action?
- What is better way to use Bootstrap inside admin panel?
- Updating my plugin without releasing a new version
- Is it possible to check is loaded language files correctly with WordPress plugin?
- Limit role to one plugin [duplicate]
- How to fix Uninitialized string offset: error on a checkbox in WP Settings API
- Upgrade private plugin without deleting files?
- Saving value of a selection option in comment form as comment meta
- Is there some way to provide the user a list of existing content in a CPT
- Is this best practice for Dynamically adding items to WordPress menus?
- There is a problem in the gutenberg block I developed. Problem is with withInstanceId
- best way to make a WordPresss multisite that is secure but at the same time supporting my plugin development efforts
- How to get post content by get_posts function?
- Getting following web services error after activating the Rewards Plugin
- WordPress custom taxonomy check box to dropdown
- How to remove plugin-specific custom taxonomy terms when plugin is uninstalled?
- How to modify files inside wp-includes directory in wordpress
- Fatal error: Call to a member function get_page_permastruct() on a non-object
- add_submenu_page hooked function must explicitly check user capabilities – why?
- How to apply style_loader_src filter with exclusion of a specific file?
- Which is the better way to store images for the plugin?
- Minimum Widget Width for Plugin Development
- Should I use wp-content/cache or [PLUGIN_DIR]/cache?
- Restrict certain actions to plugin-specific admin menu pages only
- Adding tables to dashboard pages programmatically?
- how to add custom fields into new & update post page?
- List all user post API endpoint
- Condition to check previous next article post title
- Multisite and the JSON REST API: How to?
- Looping single post in a theme
- WP Ajax on page load not working on bluehost but was working on Godaddy
- How can I send an id over the url?
- Creating custom Insert Media page
- Get fields of a widget
- Initialize class inside plugin
- How do you filter get_media_items by mime type in a custom media upload tab?
- Trying to build a plugin – Cannot modify header information
- WordPress plugin boilerplate AJAX functionality