mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-14 05:40:30 +00:00
Streamline support for multiple post types in get_posts_by_author_sql().
* Don't accept a comma-separated list, only a single post type or an array of post types. This is easier to document. * Add changelog entries to all calling functions. Props DrewAPicture. Fixes #32243. git-svn-id: https://develop.svn.wordpress.org/trunk@32524 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -5326,9 +5326,9 @@ function wp_check_for_changed_slugs( $post_id, $post, $post_before ) {
|
||||
* published posts, and all private posts to which the user has access.
|
||||
*
|
||||
* @since 2.2.0
|
||||
* @since 4.3.0 Added the ability to pass an array to `$post_type`.
|
||||
*
|
||||
* @param string|array $post_type Array or comma-separated string of post types.
|
||||
* Currently only supports 'post' or 'page'.
|
||||
* @param string|array $post_type Single post type or an array of post types. Currently only supports 'post' or 'page'.
|
||||
* @return string SQL code that can be added to a where clause.
|
||||
*/
|
||||
function get_private_posts_cap_sql( $post_type ) {
|
||||
@@ -5339,11 +5339,11 @@ function get_private_posts_cap_sql( $post_type ) {
|
||||
* Retrieve the post SQL based on capability, author, and type.
|
||||
*
|
||||
* @since 3.0.0
|
||||
* @since 4.3.0 Introduced the ability to pass multiple post types to `$post_type`.
|
||||
* @since 4.3.0 Introduced the ability to pass an array of post types to `$post_type`.
|
||||
*
|
||||
* @see get_private_posts_cap_sql()
|
||||
*
|
||||
* @param array|string $post_type Array or comma-separated list of post type(s).
|
||||
* @param array|string $post_type Single post type or an array of post types.
|
||||
* @param bool $full Optional. Returns a full WHERE statement instead of just
|
||||
* an 'andalso' term. Default true.
|
||||
* @param int $post_author Optional. Query posts having a single author ID. Default null.
|
||||
@@ -5357,7 +5357,7 @@ function get_posts_by_author_sql( $post_type, $full = true, $post_author = null,
|
||||
if ( is_array( $post_type ) ) {
|
||||
$post_types = $post_type;
|
||||
} else {
|
||||
$post_types = preg_split( '/[\s,]+/', $post_type );
|
||||
$post_types = array( $post_type );
|
||||
}
|
||||
|
||||
$post_type_clauses = array();
|
||||
|
||||
Reference in New Issue
Block a user