# speechkit/6.3.0/src/Component/Post/Panel/Inspect/fetch/utils.js

BeyondWords – AI audio for publishers, version 6.3.0. 29 lines.

- Page: https://pluginprobe.com/plugins/speechkit/6.3.0/code/src/Component/Post/Panel/Inspect/fetch/utils.js
- Raw: https://pluginprobe.com/plugins/speechkit/6.3.0/raw/src/Component/Post/Panel/Inspect/fetch/utils.js
- Modified: 2026-04-12T21:25:20+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/speechkit/6.3.0/code/src/Component/Post/Panel/Inspect/fetch/utils.js#L10-L20`.

```javascript
/**
 * WordPress dependencies
 */
import apiFetch from '@wordpress/api-fetch';

/**
 * Update post meta via the REST API
 *
 * @param {number} postId      - The post ID to update.
 * @param {Object} metaUpdates - Key-value pairs of meta fields to update.
 *
 * @return {Promise<Object>} - The updated post object.
 */
export async function updatePostMeta( postId, metaUpdates ) {
	const updatedPost = await apiFetch( {
		path: `/wp/v2/posts/${ postId }`,
		method: 'POST',
		data: {
			meta: metaUpdates,
		},
	} );

	if ( ! updatedPost || ! updatedPost.id ) {
		throw new Error( 'Failed to update post meta.' );
	}

	return updatedPost;
}

```
