get_usernumposts WordPress Filter Hook

The get_usernumposts Wordpress hook allows you to get the number of posts a user has made. This can be useful for displaying a user's post count on their profile page, or for finding out how active a user is on your site.

apply_filters( 'get_usernumposts', int $count, int $userid, string|array $post_type, bool $public_only ) #

Filters the number of posts a user has written.


Parameters

$count

(int)The user's post count.

$userid

(int)User ID.

$post_type

(string|array)Single post type or array of post types to count the number of posts for.

$public_only

(bool)Whether to limit counted posts to public posts.


Top ↑

Source

File: wp-includes/user.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
4.3.1Added $public_only argument.
4.1.0Added $post_type argument.
2.7.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More