MenuQueries LibraryDuplicate a postDuplicate a postThis query duplicates a post. query InitializeDynamicVariables @configureWarningsOnExportingDuplicateVariable(enabled: false) { authorID: _echo(value: null) @export(as: "authorID") @remove categoryIDs: _echo(value: []) @export(as: "categoryIDs") @remove featuredImageID: _echo(value: null) @export(as: "featuredImageID") @remove tagIDs: _echo(value: []) @export(as: "tagIDs") @remove } query GetPostAndExportData($postId: ID!) @depends(on: "InitializeDynamicVariables") { post(by: { id: $postId }, status: any) { # Fields not to be duplicated id slug date status # Fields to be duplicated author { id @export(as: "authorID") } categories { id @export(as: "categoryIDs", type: LIST) } rawContent @export(as: "rawContent") rawExcerpt @export(as: "excerpt") featuredImage { id @export(as: "featuredImageID") } tags { id @export(as: "tagIDs", type: LIST) } rawTitle @export(as: "title") } } mutation DuplicatePost @depends(on: "GetPostAndExportData") { createPost(input: { status: draft, authorBy: { id: $authorID }, categoriesBy: { ids: $categoryIDs }, contentAs: { html: $rawContent }, excerpt: $excerpt featuredImageBy: { id: $featuredImageID }, tagsBy: { ids: $tagIDs }, title: $title }) { status errors { __typename ...on ErrorPayload { message } } post { # Fields not to be duplicated id slug date status # Fields to be duplicated author { id } categories { id } rawContent excerpt featuredImage { id } tags { id } title } } }CopyPrevDistribute content from an upstream to multiple downstream WordPress sitesNextDuplicate multiple posts
This query duplicates a post. query InitializeDynamicVariables @configureWarningsOnExportingDuplicateVariable(enabled: false) { authorID: _echo(value: null) @export(as: "authorID") @remove categoryIDs: _echo(value: []) @export(as: "categoryIDs") @remove featuredImageID: _echo(value: null) @export(as: "featuredImageID") @remove tagIDs: _echo(value: []) @export(as: "tagIDs") @remove } query GetPostAndExportData($postId: ID!) @depends(on: "InitializeDynamicVariables") { post(by: { id: $postId }, status: any) { # Fields not to be duplicated id slug date status # Fields to be duplicated author { id @export(as: "authorID") } categories { id @export(as: "categoryIDs", type: LIST) } rawContent @export(as: "rawContent") rawExcerpt @export(as: "excerpt") featuredImage { id @export(as: "featuredImageID") } tags { id @export(as: "tagIDs", type: LIST) } rawTitle @export(as: "title") } } mutation DuplicatePost @depends(on: "GetPostAndExportData") { createPost(input: { status: draft, authorBy: { id: $authorID }, categoriesBy: { ids: $categoryIDs }, contentAs: { html: $rawContent }, excerpt: $excerpt featuredImageBy: { id: $featuredImageID }, tagsBy: { ids: $tagIDs }, title: $title }) { status errors { __typename ...on ErrorPayload { message } } post { # Fields not to be duplicated id slug date status # Fields to be duplicated author { id } categories { id } rawContent excerpt featuredImage { id } tags { id } title } } }Copy