Title: WP_HTTP_Polling_Sync_Server::add_update
Published: May 20, 2026

---

# WP_HTTP_Polling_Sync_Server::add_update( string $room, int $client_id, string $type, string $data ): true|󠀁[WP_Error](https://developer.wordpress.org/reference/classes/wp_error/)󠁿

## In this article

 * [Parameters](https://developer.wordpress.org/reference/classes/wp_http_polling_sync_server/add_update/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/classes/wp_http_polling_sync_server/add_update/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_http_polling_sync_server/add_update/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_http_polling_sync_server/add_update/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_http_polling_sync_server/add_update/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_http_polling_sync_server/add_update/?output_format=md#wp--skip-link--target)

This function’s access is marked private. This means it is not intended for use 
by plugin or theme developers, only by core. It is listed here for completeness.

Adds an update to a room’s update list via storage.

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/wp_http_polling_sync_server/add_update/?output_format=md#parameters)󠁿

 `$room`stringrequired

Room identifier.

`$client_id`intrequired

Client identifier.

`$type`stringrequired

Update type (sync_step1, sync_step2, update, compaction).

`$data`stringrequired

Base64-encoded update data.

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_http_polling_sync_server/add_update/?output_format=md#return)󠁿

 true|[WP_Error](https://developer.wordpress.org/reference/classes/wp_error/) True
on success, [WP_Error](https://developer.wordpress.org/reference/classes/wp_error/)
on storage failure.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_http_polling_sync_server/add_update/?output_format=md#source)󠁿

    ```php
    private function add_update( string $room, int $client_id, string $type, string $data ) {
    	$update = array(
    		'client_id' => $client_id,
    		'data'      => $data,
    		'type'      => $type,
    	);

    	if ( ! $this->storage->add_update( $room, $update ) ) {
    		return new WP_Error(
    			'rest_sync_storage_error',
    			__( 'Failed to store sync update.' ),
    			array( 'status' => 500 )
    		);
    	}

    	return true;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/collaboration/class-wp-http-polling-sync-server.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/collaboration/class-wp-http-polling-sync-server.php#L543)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/collaboration/class-wp-http-polling-sync-server.php#L543-L559)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_http_polling_sync_server/add_update/?output_format=md#related)󠁿

| Uses | Description | 
| [__()](https://developer.wordpress.org/reference/functions/__/)`wp-includes/l10n.php` |

Retrieves the translation of $text.

  | 
| [WP_Error::__construct()](https://developer.wordpress.org/reference/classes/wp_error/__construct/)`wp-includes/class-wp-error.php` |

Initializes the error.

  |

| Used by | Description | 
| [WP_HTTP_Polling_Sync_Server::process_sync_update()](https://developer.wordpress.org/reference/classes/wp_http_polling_sync_server/process_sync_update/)`wp-includes/collaboration/class-wp-http-polling-sync-server.php` |

Processes a sync update based on its type.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_http_polling_sync_server/add_update/?output_format=md#changelog)󠁿

| Version | Description | 
| [7.0.0](https://developer.wordpress.org/reference/since/7.0.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_http_polling_sync_server%2Fadd_update%2F)
before being able to contribute a note or feedback.