WP_Customize_Manager::check_changeset_lock_with_heartbeat()publicWP 4.9.0

Checks locked changeset with heartbeat API.

Метод класса: WP_Customize_Manager{}

Хуков нет.

Возвращает

Массив. The Heartbeat response.

Использование

$WP_Customize_Manager = new WP_Customize_Manager();
$WP_Customize_Manager->check_changeset_lock_with_heartbeat( $response, $data, $screen_id );
$response(массив) (обязательный)
The Heartbeat response.
$data(массив) (обязательный)
The $_POST data sent.
$screen_id(строка) (обязательный)
The screen id.

Список изменений

С версии 4.9.0 Введена.

Код WP_Customize_Manager::check_changeset_lock_with_heartbeat() WP 6.5.2

public function check_changeset_lock_with_heartbeat( $response, $data, $screen_id ) {
	if ( isset( $data['changeset_uuid'] ) ) {
		$changeset_post_id = $this->find_changeset_post_id( $data['changeset_uuid'] );
	} else {
		$changeset_post_id = $this->changeset_post_id();
	}

	if (
		array_key_exists( 'check_changeset_lock', $data )
		&& 'customize' === $screen_id
		&& $changeset_post_id
		&& current_user_can( get_post_type_object( 'customize_changeset' )->cap->edit_post, $changeset_post_id )
	) {
		$lock_user_id = wp_check_post_lock( $changeset_post_id );

		if ( $lock_user_id ) {
			$response['customize_changeset_lock_user'] = $this->get_lock_user_data( $lock_user_id );
		} else {

			// Refreshing time will ensure that the user is sitting on customizer and has not closed the customizer tab.
			$this->refresh_changeset_lock( $changeset_post_id );
		}
	}

	return $response;
}