PluginProbe
BeyondWords – AI audio for publishers / 6.3.0
BeyondWords – AI audio for publishers v6.3.0
7.1.0 trunk 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.1.0 4.1.1 4.1.2 4.2.0 4.2.1 4.2.2 4.2.3 4.2.4 4.3.0 4.4.0 4.5.0 4.5.1 4.6.0 4.6.1 4.6.2 4.7.0 All 43 releases
speechkit / src / Component / Post / Panel / Inspect / fetch / utils.js

utils.js in BeyondWords – AI audio for publishers 6.3.0, at src/Component/Post/Panel/Inspect/fetch/utils.js

29 lines 640 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * WordPress dependencies
3 */
4 import apiFetch from '@wordpress/api-fetch';
5
6 /**
7 * Update post meta via the REST API
8 *
9 * @param {number} postId - The post ID to update.
10 * @param {Object} metaUpdates - Key-value pairs of meta fields to update.
11 *
12 * @return {Promise<Object>} - The updated post object.
13 */
14 export async function updatePostMeta( postId, metaUpdates ) {
15 const updatedPost = await apiFetch( {
16 path: `/wp/v2/posts/${ postId }`,
17 method: 'POST',
18 data: {
19 meta: metaUpdates,
20 },
21 } );
22
23 if ( ! updatedPost || ! updatedPost.id ) {
24 throw new Error( 'Failed to update post meta.' );
25 }
26
27 return updatedPost;
28 }
29