Title: get_usernumposts
Published: April 25, 2014
Last modified: May 20, 2026

---

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

## In this article

 * [Parameters](https://developer.wordpress.org/reference/hooks/get_usernumposts/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/get_usernumposts/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/get_usernumposts/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/get_usernumposts/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/hooks/get_usernumposts/?output_format=md#wp--skip-link--target)

Filters the number of posts a user has written.

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/get_usernumposts/?output_format=md#parameters)󠁿

 `$count`string

The user’s post count as a numeric string.

`$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.

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/get_usernumposts/?output_format=md#source)󠁿

    ```php
    return apply_filters( 'get_usernumposts', $count, $userid, $post_type, $public_only );
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/user.php#L645)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/user.php#L645-L645)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/get_usernumposts/?output_format=md#related)󠁿

| Used by | Description | 
| [count_user_posts()](https://developer.wordpress.org/reference/functions/count_user_posts/)`wp-includes/user.php` |

Gets the number of posts a user has written.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/get_usernumposts/?output_format=md#changelog)󠁿

| Version | Description | 
| [4.3.1](https://developer.wordpress.org/reference/since/4.3.1/) | Added `$public_only` argument. | 
| [4.1.0](https://developer.wordpress.org/reference/since/4.1.0/) | Added `$post_type` argument. | 
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fget_usernumposts%2F)
before being able to contribute a note or feedback.