WPDev.one
Core Function
View Source on Trac ↗

get_posts_by_author_sql()

get_posts_by_author_sql( mixed $post_type, mixed $full = true, mixed $post_author = null, mixed $public_only = false )

Retrieves the post SQL based on capability, author, and type.

Parameters 3 required

Name / Type Description
(string

| string[]) $post_type Single post type or an array of post types.

Required
bool

$full Optional. Returns a full WHERE statement instead of just an 'andalso' term. Default true.

Required
$post_author
int

Optional. Query posts having a single author ID. Default null.

bool

$public_only Optional. Only return public posts. Skips cap checks for $current_user. Default false.

Required

Return Value

(string)
SQL WHERE code that can be added to a query.

Function Information

Since Version
3.0.0
Source File
wp-includes/post.php
Advertisement