WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )apply_filters( "hook_name", "what_to_filter" ).Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
This hook occurs 2 times in this file.
| Line | Code |
|---|---|
| 3414 | if ( false !== $counts ) { |
| 3415 | // We may have cached this before every status was registered. |
| 3416 | foreach ( get_post_stati() as $status ) { |
| 3417 | if ( ! isset( $counts->{$status} ) ) { |
| 3418 | $counts->{$status} = 0; |
| 3419 | } |
| 3420 | } |
| 3421 | |
| 3422 | /** This filter is documented in wp-includes/post.php */ |
| 3423 | return apply_filters( 'wp_count_posts', $counts, $type, $perm ); |
| 3424 | } |
| 3425 | |
| 3426 | if ( |
| 3427 | 'readable' === $perm && |
| 3428 | is_user_logged_in() && |
| 3429 | ! current_user_can( get_post_type_object( $type )->cap->read_private_posts ) |
| 3430 | ) { |
| 3431 | // Optimized query uses subqueries which can leverage DB indexes for better performance. See #61097. |
| 3432 | $query = " |
| Line | Code |
| 3471 | * |
| 3472 | * @since 3.7.0 |
| 3473 | * |
| 3474 | * @param stdClass $counts An object containing the current post_type's post |
| 3475 | * counts by status. |
| 3476 | * @param string $type Post type. |
| 3477 | * @param string $perm The permission to determine if the posts are 'readable' |
| 3478 | * by the current user. |
| 3479 | */ |
| 3480 | return apply_filters( 'wp_count_posts', $counts, $type, $perm ); |
| 3481 | } |
| 3482 | |
| 3483 | /** |
| 3484 | * Counts number of attachments for the mime type(s). |
| 3485 | * |
| 3486 | * If you set the optional mime_type parameter, then an array will still be |
| 3487 | * returned, but will only have the item you are looking for. It does not give |
| 3488 | * you the number of attachments that are children of a post. You can get that |
| 3489 | * by counting the number of children that post has. |