Search...
getPostBySlug( )
Developer Preview
Retrieves a single post by URL slug.
Syntax
function getPostBySlug(slug: string, options: GetPostBySlugOptions): Promise<PostResponse>
getPostBySlug Parameters
NAME
TYPE
DESCRIPTION
slug
string
URL slug.
options
Optional
GetPostBySlugOptions
Options specifying which additional fields to return.
Returns
Return Type:
Promise<
PostResponse
>NAME
TYPE
DESCRIPTION
post
Post
Post for the provided post ID.
Was this helpful?
getPostBySlug example
Copy Code
1import { posts } from 'wix-forum.v2';23 async function getPostBySlug(slug, options) {4 try {5 const result = await posts.getPostBySlug(slug, options);67 return result;8 } catch (error) {9 console.error(error);10 // Handle the error11 }12 }13