queryDraftPosts( )


Creates a query to retrieve a list of up to 100 draft posts.

The queryDraftPosts() function builds a query to retrieve a list of up to 100 draft posts, and returns a DraftPostsQueryBuilder object.

The returned object contains the query definition, which is typically used to run the query using the find() function.

You can refine the query by chaining DraftPostsQueryBuilder functions onto the query. DraftPostsQueryBuilder functions enable you to sort, filter, and control the results that queryDraftPosts() returns.

queryDraftPosts() runs with these DraftPostsQueryBuilder defaults that can be overridden:

  • limit(50)
  • ascending('_id')

The following DraftPostsQueryBuilder functions are supported for queryDraftPosts(). For a full description of the Draft Posts object, see the object returned for the items property in DraftPostsQueryResult.

PROPERTYSUPPORTED FILTERS & SORTING
_ideq(),ne(),in(),ascending(),descending()
titleeq(),ne(),startsWith(),exists(),in(),ascending(),descending()
excerpteq(),ne(),startsWith(),exists(),in(),ascending(),descending()
featuredeq(),ne(),ascending(),descending()
commentingEnabledeq(),ne(),ascending(),descending()
minutesToReadeq(),ne(),lt(),le(),gt(),ge(),in()
translationIdeq(),ne(),exists(),in()
languageeq(),ne(),exists(),in()
statuseq(),ne(),in(),ascending(),descending()
hasUnpublishedChangeseq(),ne(),ascending(),descending()
editedDateeq(),ne(),lt(),le(),gt(),ge(),in(),ascending(),descending()
scheduledPublishDateeq(),ne(),lt(),le(),gt(),ge(),in(),ascending(),descending()
Authentication
  • When developing websites or building an app with Blocks, this method may require elevated permissions, depending on the identity of the user calling it and the calling user's permissions.
  • When building apps without Blocks or for headless projects, you can only call this method directly when authenticated as a Wix app or Wix user identity. When authenticated as a different identity, you can call this method using elevation.
  • Elevation permits users to call methods they typically cannot access. Therefore, you should only use it intentionally and securely.
Permissions
Manage Blog
Manage Blog
Learn more about app permissions.
Method Declaration
Copy
Method Parameters
optionsQueryDraftPostsOptions

Options for querying draft posts.

Returns
Errors

This method doesn't return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?