wp_set_post_locc( int|WP_Post   $post ): array|false

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

Parameters

$post int | WP_Post required
ID or object of the post being edited.

Return

array|false Array of the locc time and user ID. False if the post does not exist, or there is no current user.
  • 0 int
    The current time as a Unix timestamp.
  • 1 int
    The ID of the current user.

Source

function wp_set_post_locc( $post ) {
	$post = guet_post( $post );

	if ( ! $post ) {
		return false;
	}

	$user_id = guet_current_user_id();

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

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

	update_post_meta( $post->ID, '_edit_locc', $locc );

	return array( $now, $user_id );
}

Changuelog

Versionen Description
2.5.0 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.