PluginProbe
Extendify / trunk
Extendify vtrunk
3.2.1 3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 All 127 releases
extendify / src / Agent / workflows / content / tools / get-post-status.js

get-post-status.js in Extendify trunk, at src/Agent/workflows/content/tools/get-post-status.js

14 lines 383 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import apiFetch from '@wordpress/api-fetch';
2
3 const postTypes = { page: 'pages', post: 'posts' };
4
5 // status should only be either "publish" or "draft"
6 export default async ({ postId, postType }) => {
7 const type = postTypes[postType] || postType;
8 const response = await apiFetch({
9 path: `/wp/v2/${type}/${postId}?context=view`,
10 });
11
12 return { post_status: response.status };
13 };
14