Title: wp_count_posts
Published: April 25, 2014
Last modified: February 24, 2026

---

# apply_filters( ‘wp_count_posts’, stdClass $counts, string $type, string $perm )

## In this article

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

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

Filters the post counts by status for the current post type.

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

 `$counts`stdClass

An object containing the current post_type’s post counts by status.

`$type`string

Post type.

`$perm`string

The permission to determine if the posts are `'readable'` by the current user.

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

    ```php
    return apply_filters( 'wp_count_posts', $counts, $type, $perm );
    ```

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

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

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

Counts number of posts of a post type and if user has permissions to view.

  |

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

| Version | Description | 
| [3.7.0](https://developer.wordpress.org/reference/since/3.7.0/) | Introduced. |

## User Contributed Notes

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