wpseek.com
Uma área de pesquisa sobre o WordPress para devs e autores do tema



wp_set_post_lock › WordPress Function

Desde2.5.0
Obsoleton/a
wp_set_post_lock ( $post )
Parâmetros:
  • (int|WP_Post) $post ID or object of the post being edited.
    Required: Yes
Retorna:
  • (array|false) { Array of the lock time and user ID. False if the post does not exist, or there is no current user. @type int $0 The current time as a Unix timestamp. @type int $1 The ID of the current user. }
Definido em:
Codex:

Marks the post as currently being edited by the current user.



Fonte

function wp_set_post_lock( $post ) {
	$post = get_post( $post );

	if ( ! $post ) {
		return false;
	}

	$user_id = get_current_user_id();

	if ( 0 == $user_id ) {
		return false;
	}

	$now  = time();
	$lock = "$now:$user_id";

	update_post_meta( $post->ID, '_edit_lock', $lock );

	return array( $now, $user_id );
}