Definition:
function wp_set_post_lock( $post_id ) {}
Mark the post as currently being edited by the current user
Parameters
- int $post_id: ID of the post to being edited
Return values
returns:Returns false if the post doesn’t exist of there is no current user, or an array of the lock time and the user ID.
Source code
function wp_set_post_lock( $post_id ) { if ( !$post = get_post( $post_id ) ) return false; if ( 0 == ($user_id = get_current_user_id()) ) return false; $now = time(); $lock = "$now:$user_id"; update_post_meta( $post->ID, '_edit_lock', $lock ); }
4115
No comments yet... Be the first to leave a reply!