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

---

# get_usernumposts( int $userid ): int

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/get_usernumposts/?output_format=md#description)
    - [See also](https://developer.wordpress.org/reference/functions/get_usernumposts/?output_format=md#see-also)
 * [Parameters](https://developer.wordpress.org/reference/functions/get_usernumposts/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/get_usernumposts/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/get_usernumposts/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/get_usernumposts/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/get_usernumposts/?output_format=md#changelog)

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

This function has been deprecated since 3.0.0. Use [count_user_posts()](https://developer.wordpress.org/reference/functions/count_user_posts/)
instead.

Retrieves the number of posts a user has written.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/get_usernumposts/?output_format=md#description)󠁿

### 󠀁[See also](https://developer.wordpress.org/reference/functions/get_usernumposts/?output_format=md#see-also)󠁿

 * [count_user_posts()](https://developer.wordpress.org/reference/functions/count_user_posts/)

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

 `$userid`intrequired

User to count posts for.

## 󠀁[Return](https://developer.wordpress.org/reference/functions/get_usernumposts/?output_format=md#return)󠁿

 int Number of posts the given user has written.

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

    ```php
    function get_usernumposts( $userid ) {
    	_deprecated_function( __FUNCTION__, '3.0.0', 'count_user_posts()' );
    	return count_user_posts( $userid );
    }
    ```

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

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

| Uses | 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.

  | 
| [_deprecated_function()](https://developer.wordpress.org/reference/functions/_deprecated_function/)`wp-includes/functions.php` |

Marks a function as deprecated and inform when it has been used.

  |

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

| Version | Description | 
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Deprecated. Use [count_user_posts()](https://developer.wordpress.org/reference/functions/count_user_posts/)  | 
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |

## User Contributed Notes

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