> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # Method name: publishDraftPost(draftPostId: string) # Method package: wixBlogBackend # Method menu location: wixBlogBackend --> draftPosts --> publishDraftPost # Method Link: https://dev.wix.com/docs/velo/apis/wix-blog-backend/draft-posts/publish-draft-post.md # Method Description: Publishes a specified draft post by ID. This creates a new post entity with the data from the draft post. If the specified draft post was already published, the published post will be updated with the latest values from the draft post entity. # Method Code Examples: *** Note: do not assume any prop names or enum values other than the ones in the example. ## Publish a draft post (export from backend code) ```javascript import { draftPosts } from 'wix-blog-backend'; import { webMethod, Permissions } from 'wix-web-module'; import { elevate } from 'wix-auth'; // Sample draftPostId value = "6f4d3a1e-dec6-4818-b8b0-9fb62862aa5b" const elevatedPublishDraftPost = elevate(draftPosts.publishDraftPost); export const myPublishDraftPostFunction = webMethod( Permissions.Admin, async (draftPostId) => { try { const publishedPost = await elevatedPublishDraftPost(draftPostId); console.log('Successfully published the following post:', publishedPost); return draftPostId; } catch (error) { console.error(error); // Handle the error } } ); /* Promise resolves to: * { * "postId": "6f4d3a1e-dec6-4818-b8b0-9fb62862aa5b" * } */ ``` ## Publish a draft post (dashboard page code) ```javascript import { draftPosts } from 'wix-blog-backend'; // Sample draftPostId value = "6f4d3a1e-dec6-4818-b8b0-9fb62862aa5b" export async function myPublishDraftPostFunction(draftPostId) { try { const publishedPost = await draftPosts.publishDraftPost(draftPostId); console.log('Successfully published the following post:', publishedPost); return draftPostId; } catch (error) { console.error(error); // Handle the error } } /* Promise resolves to: * { * "postId": "6f4d3a1e-dec6-4818-b8b0-9fb62862aa5b" * } */ ``` ---