# extendify/3.1.1/src/Agent/workflows/content/tools/update-post-status.js

Extendify, version 3.1.1. 14 lines.

- Page: https://pluginprobe.com/plugins/extendify/3.1.1/code/src/Agent/workflows/content/tools/update-post-status.js
- Raw: https://pluginprobe.com/plugins/extendify/3.1.1/raw/src/Agent/workflows/content/tools/update-post-status.js
- Modified: 2025-10-23T16:20:58+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/extendify/3.1.1/code/src/Agent/workflows/content/tools/update-post-status.js#L10-L20`.

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

const postTypes = { page: 'pages', post: 'posts' };

// status should only be either "publish" or "draft"
export default async ({ postId, postType, updatedStatus }) => {
	const type = postTypes[postType] || postType;
	return await apiFetch({
		path: `/wp/v2/${type}/${postId}?context=edit`,
		method: 'POST',
		data: { status: updatedStatus },
	});
};

```
