function get_private_posts_cap_sql( $post_type ) {}

Retrieve the private post SQL based on capability.
This function provides a standardized way to appropriately select on the post_status of a post type. The function will return a piece of SQL code that can be added to a WHERE clause; this SQL is constructed to allow all published posts, and all private posts to which the user has access.


  • string $post_type: currently only supports ‘post’ or ‘page’.

Return values

returns:SQL code that can be added to a where clause.

Source code

function get_private_posts_cap_sql( $post_type ) {

	return get_posts_by_author_sql( $post_type, false );



No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: