get_posts_by_author_sql()获取post的SQL查询语句

目录

描述

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

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.


<?php get_posts_by_author_sql$post_type$full$post_author$public_only); ?>

get_posts_by_author_sql() 描述

参数

$post_type

(string) (必填) Post type.

默认值: None

$full

(boolean) (可选) Optional. Returns a full WHERE statement instead of just an 'andalso' term.

默认值: true

$post_author

(integer) (可选) Query posts having a single author ID.

默认值: null

$public_only

(bool) (可选) Only return public posts. Skips capability checks for the current user.

默认值: false

get_posts_by_author_sql() 参数

返回值

(string

SQL WHERE code that can be added to a query.

get_posts_by_author_sql() 返回值

示例

get_posts_by_author_sql() 示例

历史

添加于 版本: 3.0

get_posts_by_author_sql() 历史