Pass the `$public_only` value to 'get_usernumposts' filter.
[32523] introduced the $public_only parameter to `count_user_posts()`. That changeset was supposed to pass `$public_only` to the 'get_usernumposts' filter at the end of the function, but only the documentation was modified, not the filter itself. This changeset also fixes an incorrect variable name in the docblock for the same filter, and includes clarification on the accepted values for the `$post_type` parameter. Merges [33710] and [33716] to the 4.3 branch. Props swisspidy, tmatsuur, tyxla, DrewAPicture. Fixes #33481 for 4.3.1. Built from https://develop.svn.wordpress.org/branches/4.3@33953 git-svn-id: http://core.svn.wordpress.org/branches/4.3@33922 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
5b643782b6
commit
8c51f55fdd
|
@ -261,7 +261,7 @@ function wp_validate_logged_in_cookie( $user_id ) {
|
|||
* @global wpdb $wpdb WordPress database object for queries.
|
||||
*
|
||||
* @param int $userid User ID.
|
||||
* @param array|string $post_type Optional. Post type(s) to count the number of posts for. Default 'post'.
|
||||
* @param array|string $post_type Optional. Single post type or array of post types to count the number of posts for. Default 'post'.
|
||||
* @param bool $public_only Optional. Whether to only return counts for public posts. Default false.
|
||||
* @return int Number of posts the user has written in this post type.
|
||||
*/
|
||||
|
@ -277,14 +277,14 @@ function count_user_posts( $userid, $post_type = 'post', $public_only = false )
|
|||
*
|
||||
* @since 2.7.0
|
||||
* @since 4.1.0 Added `$post_type` argument.
|
||||
* @since 4.3.0 Added `$public_only` argument.
|
||||
* @since 4.3.1 Added `$public_only` argument.
|
||||
*
|
||||
* @param int $count The user's post count.
|
||||
* @param int $userid User ID.
|
||||
* @param string|array $post_types Post types to count the number of posts for.
|
||||
* @param string|array $post_type Single post type or array of post types to count the number of posts for.
|
||||
* @param bool $public_only Whether to limit counted posts to public posts.
|
||||
*/
|
||||
return apply_filters( 'get_usernumposts', $count, $userid, $post_type );
|
||||
return apply_filters( 'get_usernumposts', $count, $userid, $post_type, $public_only );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue