MenuQueries LibraryReplace an old post slug with a new post slug in all postsReplace an old post slug with a new post slug in all postsAfter changing the slug of a post, execute this query to convert all content to point to the new URL. This query requires the endpoint to have Nested Mutations enabled. query ExportData( $oldPostSlug: String! $newPostSlug: String! ) { siteURL: optionValue(name: "siteurl") oldPostURL: _strAppend( after: $__siteURL, append: $oldPostSlug ) @export(as: "oldPostURL") newPostURL: _strAppend( after: $__siteURL, append: $newPostSlug ) @export(as: "newPostURL") } mutation ReplaceOldWithNewSlugInPosts @depends(on: "ExportData") { posts( filter: { search: $oldPostURL }, pagination: { limit: -1 } ) { id rawContent adaptedRawContent: _strReplace( search: $oldPostURL replaceWith: $newPostURL in: $__rawContent ) update(input: { contentAs: { html: $__adaptedRawContent } }) { status errors { __typename ...on ErrorPayload { message } } post { id rawContent } } } }CopyPrevReplace "http" with "https" in all image sources in a postNextReplace the domain for all image blocks in a post (to use a CDN)
After changing the slug of a post, execute this query to convert all content to point to the new URL. This query requires the endpoint to have Nested Mutations enabled. query ExportData( $oldPostSlug: String! $newPostSlug: String! ) { siteURL: optionValue(name: "siteurl") oldPostURL: _strAppend( after: $__siteURL, append: $oldPostSlug ) @export(as: "oldPostURL") newPostURL: _strAppend( after: $__siteURL, append: $newPostSlug ) @export(as: "newPostURL") } mutation ReplaceOldWithNewSlugInPosts @depends(on: "ExportData") { posts( filter: { search: $oldPostURL }, pagination: { limit: -1 } ) { id rawContent adaptedRawContent: _strReplace( search: $oldPostURL replaceWith: $newPostURL in: $__rawContent ) update(input: { contentAs: { html: $__adaptedRawContent } }) { status errors { __typename ...on ErrorPayload { message } } post { id rawContent } } } }Copy